News for hackers. Stuff that matters.
Re:Show HN: hint.css – a tooltip library in CSS by cstuder on Monday February 04, 2013 @10:07AM (#5164427)
For reference: Doesn't work on Internet Explorer 7, always shows the hints on Internet Explorer 8 and works fine on Internet Explorer 9 (Minus the animations.)
Re:Show HN: hint.css – a tooltip library in CSS by taf2 on Monday February 04, 2013 @09:27AM (#5164191)
very cool, use of css3 attr function. allowing the rule:

content: attr(data-hint);

see: https://developer.mozilla.org/en-US/docs/CSS/attr

Re:Show HN: hint.css – a tooltip library in CSS by city41 on Monday February 04, 2013 @10:11AM (#5164455)
I didn't know that was possible. has got my mind reeling with what I can now do with CSS. Thanks OP for making this.
Re:Show HN: hint.css – a tooltip library in CSS by nej on Monday February 04, 2013 @08:11PM (#5168396)
Here's full range of what's possible with the CSS content Property in case you're interested: http://www.w3schools.com/cssref/pr_gen_content.asp
Re:Show HN: hint.css – a tooltip library in CSS by hnriot on Monday February 04, 2013 @11:24AM (#5164935)
What's wrong with title="my took tip" and let th browser do it? For browsers that don't its a single line of jQuery.
Re:Show HN: hint.css – a tooltip library in CSS by pornel on Monday February 04, 2013 @12:16PM (#5165404)
Unfortunately `title` implementations are broken for pretty much everybody except mouse users on desktop:

http://www.paciellogroup.com/blog/2013/01/using-the-html-tit...

Re:Show HN: hint.css – a tooltip library in CSS by philfreo on Monday February 04, 2013 @03:37PM (#5166940)
The time spent hovering for the built in title attribute to be displayed is so long that most users will never see/notice the tooltip.
Re:Show HN: hint.css – a tooltip library in CSS by danso on Monday February 04, 2013 @11:32AM (#5164997)
Because the browser may render the tool tip slower than you'd like. Plus, it may be too generic a look for bespoke sites.
Re:Show HN: hint.css – a tooltip library in CSS by baby on Monday February 04, 2013 @12:20PM (#5165457)
it's just stylizing. What CSS does in general.
Re:Show HN: hint.css – a tooltip library in CSS by ibrahima on Monday February 04, 2013 @07:23PM (#5168219)
It'd be interesting if you could just apply CSS to title attributes rather than have to add stuff to the DOM to reimplement a basic browser feature. Certainly these types of tooltip libraries look and behave better, but I wonder if it's really the best solution.
Re:Show HN: hint.css – a tooltip library in CSS by baby on Tuesday February 05, 2013 @03:23AM (#5169720)
Legit CSS for tooltip and scrolling bars will arrive some day. I hope.
Re:Show HN: hint.css – a tooltip library in CSS by tambourine_man on Monday February 04, 2013 @10:06AM (#5164411)
Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Monday February 04, 2013 @09:45AM (#5164290)
Glad you guyz liked it and thought it to be useful :)
Re:Show HN: hint.css – a tooltip library in CSS by wazari972 on Monday February 04, 2013 @10:14AM (#5164472)
do you think you can adapt it to display an entire <span> ? That's very neat, but just single string text is not enough for me!
Re:Show HN: hint.css – a tooltip library in CSS by JangoSteve on Monday February 04, 2013 @08:24PM (#5168442)
It's wouldn't be possible if you're only using CSS. See this stackoverflow post [1], or more specifically the spec it references [2] on the CSS content property (used by this library).

The acceptable values are:

    normal | none | [ string | uri | counter | attr(identifier) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
You might think, maybe you could insert html by putting the html on an attribute and using the attr() value, but reading further:

This function returns as a string the value of attribute X for the subject of the selector. The string is not parsed by the CSS processor.

[1] http://stackoverflow.com/questions/4505093/css-content-prope...

[2] http://www.w3.org/TR/CSS21/generate.html#propdef-content

Re:Show HN: hint.css – a tooltip library in CSS by wazari972 on Tuesday February 05, 2013 @03:53AM (#5169796)
too bad ... I guess it means we're stuck with JS to display multiline and/or format tooltips ...
Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Tuesday February 05, 2013 @04:30AM (#5169884)
for the time being, yes.
Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Monday February 04, 2013 @12:54PM (#5165739)
You mean you want to show HTML inside the tooltip?
Re:Show HN: hint.css – a tooltip library in CSS by wazari972 on Monday February 04, 2013 @02:48PM (#5166592)
yes indeed, especially to allow multiline. (but maybe that's not your original intend ... ?)
Re:Show HN: hint.css – a tooltip library in CSS by davefp on Monday February 04, 2013 @10:37AM (#5164610)
Neat idea, and seems to work well.

On the other hand, having to include two classes seems sloppy. Why not just roll the core styles into the position classes, or include a default position in the 'hint' class?

Double dashes in class names are also annoying.

Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Monday February 04, 2013 @12:49PM (#5165701)
Thanks. I thought of putting the core into the position classes but that seemed to duplicate some styles in the generated CSS. Though having a default position surely seems a nice idea. Will work on it :)
Re:Show HN: hint.css – a tooltip library in CSS by alpb on Monday February 04, 2013 @12:49PM (#5165703)
Finally we can get rid of Tipsy.js http://onehackoranother.com/projects/jquery/tipsy/
Re:Show HN: hint.css – a tooltip library in CSS by andypants on Monday February 04, 2013 @06:12PM (#5167892)
Is there something wrong with tipsy.js?

I just took a quick look at it, and it seems like a nice tooltip library.

Re:Show HN: hint.css – a tooltip library in CSS by byroot on Monday February 04, 2013 @08:23PM (#5168437)
Well, Tipsy, bootstrap tooltips and similar javascript based tooltips require you to initialize them.

It's fine if you have a mostly static page, so you can initialize all fo them on domready.

But if you are in a very dynamic page with pjax or a Javascript MVC app, you always have to initialize them again on any page change.

It's costly and error prone. This pure CSS solution in the other hand do not require any initialization. You put the HTML with the proper classes and it will just works.

Re:Show HN: hint.css – a tooltip library in CSS by Andrex on Monday February 04, 2013 @11:23AM (#5164924)
I really like it, but part of me thinks the better way would be to just use whatever's on the title attribute of an element, which would of course need JavaScript. I guess this would be better for lighter sites.

Edit- I misunderstood how this works, I thought you actually had to add <span>s (extra markup) but it seems not! This is really great!

My only complaint is that it messes with elements if you're doing the :before/after thing for font icons.

Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Monday February 04, 2013 @12:53PM (#5165728)
Thanks Andrex. The issue with using title attribute is that its hard to suppress the default tooltip that shows up with just CSS. Any idea if it can be done?
Re:Show HN: hint.css – a tooltip library in CSS by Andrex on Tuesday February 05, 2013 @12:32PM (#5171912)
Not without JS as far as I know, which is unfortunate. It really should be some kind of CSS attribute.
Re:Show HN: hint.css – a tooltip library in CSS by hjay on Monday February 04, 2013 @06:15PM (#5167905)
Nice job.

I created something extremely similar a few months back for my day job (wow the traffic I missed out on!).

One thing I've encountered in this and in my own implementation: the hint gets blocked by iframe if it's nearby. Has anyone figured out a way to reliably have it appear over the iframe instead of under? I've been struggling with it for a while and have not figured it out.

Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Tuesday February 05, 2013 @04:32AM (#5169891)
Thanks. I'll have to check this iframe thing though the z-index should take care I guess.
Re:Show HN: hint.css – a tooltip library in CSS by rdsubhas on Monday February 04, 2013 @10:18AM (#5164492)
Awesome!! (But the double hyphen in 'hint--top' or 'hint--left' is a bit cheesy...)
Re:Show HN: hint.css – a tooltip library in CSS by philipwalton on Monday February 04, 2013 @11:35AM (#5165026)
The double hyphen is actually part of a pretty common naming convention (BEM-style) for distinguishing between separate components, component modifiers, and component sub-objects.

Examples: https://gist.github.com/1309546 http://nicolasgallagher.com/about-html-semantics-front-end-a... http://csswizardry.com/2013/01/mindbemding-getting-your-head... http://engineering.appfolio.com/2012/11/16/css-architecture

Re:Show HN: hint.css – a tooltip library in CSS by jackmoore on Monday February 04, 2013 @11:59PM (#5169232)
Good job with the citations
Re:Show HN: hint.css – a tooltip library in CSS by kaichanvong on Monday February 04, 2013 @10:22AM (#5164511)
Also liked it - and agree, double hyphen is mega ewww.
Re:Show HN: hint.css – a tooltip library in CSS by jtokoph on Monday February 04, 2013 @10:52AM (#5164699)
The one downside to any library that uses before/after pseudo elements is that they take over the pseudo elements and can no longer be used for other purposes.

I would say that they should only be used for styling and not functionality.

Re:Show HN: hint.css – a tooltip library in CSS by gjunkie on Monday February 04, 2013 @09:51AM (#5164317)
Very clever. FWIW There are some issues when the node is near the edge of the window. The browser will display the contents of a title attribute atop the browser chrome, but your tooltip will be hidden.
Re:Show HN: hint.css – a tooltip library in CSS by ryankshaw on Monday February 04, 2013 @11:04AM (#5164780)
one caveat, any approach like this (one that just uses css) will hide the tooltip if the thing it is tipping (or one of it's parents) is clipped by overflow:auto/scroll/hidden. the only way to get around that is using javascript (the tooltip needs to be inserted into the dom outside of the element with constrained overflow, eg: as a child of body). I've found that in any decent size project I've done, eventually I run into that scenario, so I usually just start with a JS based approach from the beginning (bootstrap, jqueryUI, etc)
Re:Show HN: hint.css – a tooltip library in CSS by dhaffner on Monday February 04, 2013 @12:23PM (#5165481)
Just thinking aloud here. Could that problem be avoided by putting the tooltip element outside of the thing it is tipping, and then using a CSS selector like ".tipped-element:hover + .tooltip-element"?

I'm sure there are some other caveats that would reveal themselves later even if this one is avoidable...

Re:Show HN: hint.css – a tooltip library in CSS by philipwalton on Monday February 04, 2013 @11:29AM (#5164963)
I was going to say the exact same thing, but you beat me too it!

I started with this approach when I built our tooltip library for my company, but eventually there were just too many gotchas. We switched to using JavaScript and inserting the generated element as a child of `body`.

Re:Show HN: hint.css – a tooltip library in CSS by i_like_robots on Monday February 04, 2013 @09:29AM (#5164200)
Cool, I had a similar go a while back http://jsfiddle.net/i_like_robots/qrXyE/
Re:Show HN: hint.css – a tooltip library in CSS by binarydreams on Monday February 04, 2013 @09:48AM (#5164300)
More CSS Tooltips - http://cssdeck.com/search/?q=tooltip (just sharing)
Re:Show HN: hint.css – a tooltip library in CSS by experiment0 on Monday February 04, 2013 @11:28AM (#5164961)
Only one submission on the page you linked to was actually a comparable tool tip.
Re:Show HN: hint.css – a tooltip library in CSS by figurify on Monday February 04, 2013 @09:15AM (#5164119)
brilliant... i always hated adding weirdo js for such standard tasks, polluting the content with meta-code/meta-content ugliness!
Re:Show HN: hint.css – a tooltip library in CSS by CGamesPlay on Monday February 04, 2013 @01:44PM (#5166090)
I wish it would position itself so that it was always on the screen, e.g. scroll so the top-toolip is off the screen.
Re:Show HN: hint.css – a tooltip library in CSS by sankage on Monday February 04, 2013 @10:03AM (#5164388)
Do you have a browser compatibility list?
Re:Show HN: hint.css – a tooltip library in CSS by chinchang on Monday February 04, 2013 @12:56PM (#5165749)
I'll prepare a compatibility sheet and put up soon on the project page. Meanwhile if anyone wants to take this up, please go ahead.
Re:Show HN: hint.css – a tooltip library in CSS by sauravt on Monday February 04, 2013 @09:20AM (#5164147)
Cool, I am a fan of this ever since I this on codepen. Really awesome stuff.
Re:Show HN: hint.css – a tooltip library in CSS by higaron on Monday February 04, 2013 @05:27PM (#5167612)
can we keep the tip active on hover of the tip? lets say the text was long and I wanted to traverse the text with my mouse pointer, can I have that?

just the tip!

Re:Show HN: hint.css – a tooltip library in CSS by vaidik on Monday February 04, 2013 @04:05PM (#5167128)
Awesome work Kush! Looking forward to using it! :)
Re:Show HN: hint.css – a tooltip library in CSS by quarterto on Monday February 04, 2013 @09:49AM (#5164309)
The animations work for me in Chrome dev (26).
Re:Show HN: hint.css – a tooltip library in CSS by baby on Monday February 04, 2013 @12:19PM (#5165443)
Now is foundation/bootstrap going to use it?
Re:Show HN: hint.css – a tooltip library in CSS by siddharthdeswal on Monday February 04, 2013 @09:45AM (#5164286)
Great work Kushagra. Very useful stuff.
Re:Show HN: hint.css – a tooltip library in CSS by hawkw on Monday February 04, 2013 @09:34AM (#5164218)
Well implemented. Thanks for sharing!
Re:Show HN: hint.css – a tooltip library in CSS by tonybaroneee on Monday February 04, 2013 @10:02AM (#5164384)
Truly a great tool, thanks for this!
Re:Show HN: hint.css – a tooltip library in CSS by kaolinite on Monday February 04, 2013 @09:34AM (#5164219)
Really nice - will use this.
Re:Show HN: hint.css – a tooltip library in CSS by scottmagdalein on Monday February 04, 2013 @09:39AM (#5164250)
I'm a fan.