Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

How do I make tooltips?

I had absolutely no HTML or CSS experience before getting a pro membership and diving into the process of making a custom character sheet, so I might need some ELI5 instructions on this.  Currently I have a sheet with labels detailing the names of my game's stats followed by buttons to roll the relevant ability check. I want to make it so that mousing over either the button or the label displays text explaining what scales off of that stat.  I'd be grateful for any and all insight you folks have on the matter; anything helps.
1486284804
plexsoup
Marketplace Creator
Sheet Author
API Scripter
W3schools explains them better than I could: <a href="http://www.w3schools.com/css/css_tooltip.asp" rel="nofollow">http://www.w3schools.com/css/css_tooltip.asp</a> Be sure to click the "try it yourself" buttons Remember that for Roll20, your class names should start with "sheet-"
1486293317
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
The short answer is that you add &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;title="whatever" &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; to whatever tag you want to have a tooltip.&nbsp; It can be added to labels, spans, or input tags.&nbsp; If you want the same tooltip to cover both the label and the input box, you can wrap them both within one tag that has a title.&nbsp; &nbsp; &nbsp; &lt;label title="@{Height}: &nbsp; Characters Height."&gt;Height:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;input name="attr_Height" type="text" &gt; &nbsp; &nbsp; &lt;/label&gt;
1486332603
Lithl
Pro
Sheet Author
API Scripter
It'd be nice to have access to the tipsy tooltips; Roll20 uses them for inline rolls. Simply setting a title on an element can be useful, but you can't style them and the tooltip doesn't show up until the user hovers for some time. Tipsy tooltips can contain arbitrary HTML, they have some customization of their behavior, and generally appear immediately instead of after some hover time. As far as I'm aware, it would be as simple as adding something like $('.sheet-tipsy').tipsy(); to the page to add tipsy tooltips to any character sheet element with the sheet-tipsy class. (Plus handle tipsy-fying any new characters added to the VTT.) Tipsy uses the title attribute to get its text, so it falls back gracefully, too. (If tipsy fails, you still have the normal title behavior.)
I use this&nbsp; site as a guide. &nbsp;Just remember to add "sheet-" before the css names, and you should be good.