Re: link styles

by "Eric A. Meyer" <eam3(at)po.cwru.edu>

 Date:  Mon, 22 May 2000 07:16:08 -0400
 To:  hwg-style(at)hwg.org
  todo: View Thread, Original
>Yes you can use a:link multiple times with the class modifier
><style type="text/css">
>a:link .class1 {definition}
>a:link .class2 (definition}
></style>
><a href="url" class="class1">Some text displayed one way</a>
><a href="url" class="class2">Some text displayed other way</a>

    Close, but those selectors are actually not useful for the anchors 
shown.  The selectors above would select any element with a class of 
"class1" (or "class2" which were encased in an anchor element.  For 
example:

    <a href="url">This is <em class="class1">an anchor</em> with EM text</a>

This would be matched by the first selector above, but it would only 
apply to the content of the EM element, and only in those anchor 
elements which point to unvisited resources.
    In order to address the anchors shown in the previous example, you 
would need the following selectors:

    a.class1:link {declarations}
    a.class2:link {declarations}

Of course, if you want the same styles applied to all hyperlinks 
which point to unvisited resources, then all you need is:

    a:link {declarations}

--
Eric A. Meyer (eric(at)meyerweb.com)    http://www.meyerweb.com/eric/
  Author, "CSS: The Definitive Guide" http://www.oreilly.com/catalog/css/
  Editor, Style Sheets Ref. Guide     http://style.webreview.com/
  Coordinator, W3C CSS Test Suite     http://www.w3.org/Style/CSS/Test/

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA