Reese wrote:
I'm having trouble with a moderately extensive site which has
only a rudimentary implementation of CSS. This is the CSS coding
relevant to my question:

4.
5.  a {
6.     color: #000099;
7.     text-decoration: underline;
8.     font: bold 10px Verdana, Arial, Helvetica, sans-serif;
9.     }

I'm trying to give a specific link a different style, but this
code [does not work]:

16.  #alt a:link {blah}

Your first selector "a" applies to all states of all links. However, "a:link" only applies to unvisited links. So if you have followed the link and have not cleared your browser history, the first selector will apply even when the second does not.

even this code:

16.  div#alt a:link {blah}
17.  div#alt a:active {blah}
18.  div#alt a:hover {blah}
19.  div#alt a:visited {blah}

does not work

Assuming you have the correct ID in the HTML, this should work, although your rule order may cause confusion on hover. The rules should always appear in LVHA order (LoVe HAte, if you need a mnemonic). The way you have the rules ordered, the visited rule, being last, will supercede the hover rule, so your visited links will not appear to change on hover.

You later wrote:

#order a:link a:visited a:hover a:active {
        text-decoration: none;
        font: 900 italic;
        }


That doesn't select what you think it does.  The correct syntax would be:

#order a:link, #order a:visited, #order a:hover, #order a:active {blah}

Note the order of the declarations is not relevant here, but the commas are required. Note also that I reiterated the #order part of the selector to keep the specificity the same throughout.

I would recommend that you check the list Wiki/FAQ (address at the end of each list message) to find a good selector/shorthand tutorial. I think a quick review of how selector syntax works might be helpful for you.

--

-Adam Kuehn
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to