Pure CSS Tooltips(Z)

來源:互聯網
上載者:User

What is a tooltip? This is a tooltip an
aiding text that appears just when you roll on with the mouse. The
basic idea comes from Eric Meyer's pure css
popups
a very clever way to get dynamic effects on an html page without
using javascript.

My idea was to add position:relative to the
link, in order to allow the span element inside to position absolutely
respect the parent link. This code has been tested in Ie5.5, Opera7.11 and
Mozilla 1.4 and works fine. Solved ie bug adding some z-index, but with the
modifications done this technique will be buggy in Opera7.2 .

Now, let's have a
look at the basic csscascade style sheets, the
separation from content and presentation code for the tooltip:

a.info{
    position:relative; /*this is
the key*/
    z-index:24;
background-color:#ccc;
    color:#000;
    text-decoration:none}

a.info:hover{z-index:25;
background-color:#ff0}

a.info span{display: none}

a.info:hover
span{ /*the span will display just on :hover
state*/
    display:block;
    position:absolute;
    top:2em;
left:2em; width:15em;
    border:1px solid
#0cf;
    background-color:#cff;
color:#000;
    text-align: center}

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.