SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: A:active & CSS

  1. #1
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A:active & CSS

    I'm busy working with the CSS Antholgy and trying to create TAB browsing.
    And I noticed that there is no "a:active" mentioned anywhere in the CSS. Is this not supporter anymore? I am trying to make my "a:visited" tabs different from the current page's TAB I'm looking at. I hope you follow what I'm trying to say.

    I tested this in IE. The "a:active" only briefly works when you click on it, but goes back to "a:visited" when you release the mouse.

  2. #2
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Hi there,

    I think you misunderstand the purpose of :active. It is not a mechanism to highlight the active/current page link - you will need to do that through a CLASS/ID (either dropped in manually or with help of a server-side language if you're making a dynamic site).

    Example:
    HTML Code:
    <ul id="nav">
      <li class="active"><a href="#">Index</a></li>
      <li><a href="#">About Us</a></li>
      <li><a href="#">Contact</a></li>
    </ul>
    Code:
    #nav a {
      color: pink;
    }
    
    #nav .active a {
      color: yellow;
      font-weight: bold;
    }
    From: http://www.w3.org/TR/CSS21/selector....pseudo-classes
    The :active pseudo-class applies while an element is being activated by the user. For example, between the times the user presses the mouse button and releases it.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    Utrecht (Netherlands, the)
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as I know, that's how the a:active is supposed to work. It is active when you click on a link and persists until you release your mouse again.

    If you want a different look for the current tab, you could make a class "selected" or something and apply that to the current tab.
    Hippopotomonstrosesquippedaliophobia - Fear of long words

  4. #4
    SitePoint Addict
    Join Date
    Jun 2006
    Location
    South Africa
    Posts
    343
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much! Learning something new every day.


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
  •