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,941 times

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

  1. @mukesh:-

    Noted on other sites with a quick google search, add the following:

    .aaa2 a.tooltip:hover { /*BG color is a must for IE6*/
    background: #E3ECF4;
    text-decoration:none;
    }

    Reply to this comment
  2. Sign: umsun Hello!!! rcuwwymhyw and 6621ssgfhphzye and 3127Sorry, what did you mean?? A??

    Reply to this comment
  3. I love your site. :) Love design!!! I just came across your blog and wanted to say that I?ve really enjoyed browsing your blog posts. Sign: ndsam

    Reply to this comment
  4. Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

    Reply to this comment
  5. didzejevski buzzed on July 4th, 2009 | 1:01 pm

    Looks nice, but there is no text in the tooltip box.
    [Firefox 3.5]

    Reply to this comment
  6. Very very nice. Thx a Lot !

    Reply to this comment
  7. for ie6 add
    a.tooltip:hover { visibility:visible; }
    that’s it!.

    Reply to this comment
  8. hi,
    this does not work in IE6 can any one solve this bug?
    any help will be appreciated…..
    thanx

    Reply to this comment
5 4 3 2 1 »

    2 Trackback(s)

  1. Jul 1, 2009: A collection of Free ToolTips using AJAX, JavaScript & CSS
  2. Apr 13, 2009: Nifty Shaped Pure CSS Tooltips | Home of RIA

» 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!