colorpress - Premium WordPress Theme
$49.99

ColorPress is a theme that lets you play with color! Now, you will not be restricted to using a few color schemes provided by the developer. You have all the colors to apply to your theme! Just pick your color and magic happens. The theme comes with a configurable slideshow, 3 blog layouts, dropdown menus and a load of other options that will rock your socks!

Wix.com

Sep
01

Pure CSS Tooltips

Today I’ll teach you how top create tooltips purely using Cascading Style Sheets(CSS). Tooltips are basically little blocks of information that are used to inform users about certain attributes of your website elements. This is a tooltip example!Click on this link to see how a tooltip looks like.

Most tooltips are created with the help of javascript or some other programming languages. This can be cumbersome because not everyone wants to learn Javascript. But CSS tooltips are easy to create and can be loaded quickly without any delay.

Here is what you have to do:-

1. Make a blank HTML file and paste the following text in the BODY part :-

<a href="#" class="tooltip"><span>This is a pure CSS tooltip!</span>Tooltip 1</a>

This is the HTML part where we create a hyperlink with the text Tooltip1. In the next step, we are going to hide the text within the span tags which will serve as the tooltip text.

2. Now post this CSS information in your HEAD part of the HTML file :-

.tooltip { position:relative; z-index:24; }
.tooltip span { display:none;}
.tooltip:hover {z-index:25;}
.tooltip:hover span {
display:block;
position:absolute;
width:120px;
top:25px;
left:20px;
background-color:#FCFBDC;
border:1px solid #333333;
padding:5px;
font-size:11px;
color:#333333;
text-decoration:none;
font-family:Verdana, Arial, Helvetica, sans-serif;
}

If you look at the above code carefully, we have given the property display:none to the span tag inside the hyperlink. This will make the text inside the span tag invisible. Now when you hover your mouse, we make it appear again by giving the property display:block to the span tag on hover. The positioning of the .tooltip span class is relative because we will place the tooltip text relative to the hyperlink area and make the span tag absolute by defining its fixed position. The z-index is used so that tooltips are in the front of the hyperlink and do not overlap. The more the value of z-index, the farther in the front goes the element.

These tooltips can also be integrated into a wordpress theme easily. Just copy the CSS into your style.css file and when creating your posts, just take help of the HTML code and create your own tooltips. Rest is all styling which can be altered according to your own choice. You may also use images inside the tooltip boxes.

So, just learn this trick and you will be making nifty CSS tooltips in no time. And yes, don’t forget to leave a comment!

Download an example file

This post was viewed 14,850 times

» 50 people left comments { Collapse all | Expand all }

  1. Thanks ! Good tip & Cool…

    Reply to this comment
  2. I do like this especially since it uses CSS and not Js.. but my I ask why you have not used it throughout this whole blog?

    Reply to this comment
  3. Thanks for your nice post ^^

    Reply to this comment
  4. TY! Just what I was after.

    Reply to this comment
  5. Thank you a good tip!

    Reply to this comment
  6. Hey,

    Thank you! A Good tip!

    Regards,
    Jack

    Reply to this comment
  7. <tooltip title=”This is a tooltip”>Trigger a tooltip</tooltip>

    Reply to this comment
  8. How about a tooltip without CSS or JS? Try this on Chrome:

    Trigger a tooltip

    Awesomeness!

    Reply to this comment
« 5 4 3 2 1 »

    2 Trackback(s)

  1. Sep 15, 2008: ???? ????? l ???? ??????? l ????? » ????? ???? » ?????? ???? ???? Tooltip ??
  2. Sep 14, 2008: Design Inspirations for September 12th | isuckatdesign.com

» Leave a Comment!

Search :
Browse :
Archive :

$$$ Make Money $$$

Become an Affiliate

Welcome to Blog Oh! Blog's affiliate program! I personally invite you to make money by selling all of Blog Oh! Blog's Premium themes.

You will get a whopping 25% share on each sale generated through your affiliate link.

All you need to do is sign up as Blog Oh! Blog's affiliate, choose a banner, paste it on your website or blog and wait for sales to happen. It's as simple as that!

All affiliates will be paid on 10th of every month. Your affiliate earning needs to be a minimum $50 to get paid for each month.

Here is the sign up link and here are some banners to get you started!