How to Create Script-Free CSS3 Tooltips
Tutorial Details
- Languages: HTML/CSS
- Difficulty: Intermediate
- Estimated Completion Time: 20min
Final Product What You'll Be Creating
Ahhh… tooltips. They can be the answer to many of your support worries or if you just want to give a little hint to the user. Today there are tons of websites and applications out there using tooltips but… is there a better way to implement them? I’m excited to say that there is a better way, a Javascript free way… well for the most part. We’re going to be making some really awesome tooltips out of pure CSS3 and then we’re going to create a mobile friendly version, and this is where it gets a little hazy because to get this to work, we have to use a little Javascript fix known as none other than Dean Edwards IE9.js.
Note: There is full IE support for versions 8 and up. IE7 is also supported except for the mobile version (clickable version).
The Video Tutorial
For everyone who wants a peek into how Justin creates this in living color, check out the video below!
The Written Tutorial
And now, the full written step by step guide with fully coded instructions. Be sure to grab the source file download from up above as well!
Step 1 Creating the Markup
In the Head
Let’s start by creating the head of our document and then insert a stylsheet specifically for this tutorial. You can delete the tut.css stylesheet when implementing this in your own project, it is used only for this tutorial.
We’ve used the HTML5 doctype which is !DOCTYPE html and then called our two stylesheets. The first stylesheet is the transparency version but there are more themes to choose from in the source files. The second on is the tut.css we talked about and is only used for the purposes of styling this tutorial, but feel free to use it if you like.
After the stylesheets, is our less than IE9 statement. We’ve used an ie.css file which calls on CSSPIE telling IE 7 & 8 that it’s ok to use CSS3 features because they’re awesome! Then we called on Dean Edwards IE9.js to further tell IE7 & 8 that we need to make this work by using advanced CSS selectors.