SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Location
    Northern California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a:active won't work correctly

    Using the sytle below the a:active does not work as expected.

    The active link style is only displayed when the mouse is down.

    I took a wild shot at one idea and put a '#' after the link in the href and now it stays active if one clicks twice on the image link (in IE anyway, in FF Mac it fails)

    <p><a href="links.php#"></a></p>
    <p><a href="links2.php#"></a></p>

    http://etrips.com/TESTs/links.php

    a { /* a:link doesn't display gif? */
    display:block;
    width: 62px;
    height: 26px;
    color:#333;
    text-decoration: none;
    background-image: url(../grafbits/navbar/Nav_02-RollOver.gif);
    background-repeat: no-repeat;
    background-position: 0 0;
    font-size: 10px;
    }
    a:active {
    background-position: 0 -52px;
    width: 62px;
    height: 26px;
    color: #FFF;
    }

    a:hover {
    background-position: 0 -26px;
    width: 62px;
    height: 26px;
    color: #049;
    }

    Thanks
    sam

    P.S. Why do these technologies work so poorly? And why are these forums designed for 10 year olds?

  2. #2
    SitePoint Wizard bronze trophy Centauri's Avatar
    Join Date
    May 2007
    Location
    Newcastle, Australia
    Posts
    3,718
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zamzmith View Post
    The active link style is only displayed when the mouse is down.
    That is exactly what the :active state is supposed to do...

    If you want the link to be styled to indicate it is the current page, then you could either set and style a "current" class and assign that to the appropriate link on each page, or assign a class to each menu item and a body id to each page, and set the style based on id / class combination.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •