CSS validation Q

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a style sheet. In one of the definitions, I define the link colours

a:link {color: red;}

When I pass this through the validator at w3c, I find that I cannot do
this. Are the likes of a:link top level (i.e. global) or is there a way
for a particular definition to have it's own colour for a link?



Re: CSS validation Q

Quoted text here. Click to load it

Perfectly valid. There must be something else wrong.

Quoted text here. Click to load it

Er, what?

The URL is now required.


Re: CSS validation Q

Quoted text here. Click to load it

Really? The above is fine, although it will generate a warning - not
an error - about specifying a background-color with your color. It is
good practice to specify the two together, just in case a user has a
stylesheet with a:link {background-color: red;}.

Quoted text here. Click to load it

a:link refers to all links in the document.

To refer to specific links either:
Add a class to the <a> element and use a.classname:link {}
Add a class to the containing element of the links. e.g. <div
class="navigation"><a href="foo">bar</a> and use .navigation a:link {}

If this doesn't cover your problem you really should post a URI so
that we can check and see exactly what the validator is complaining
about, etc.


"My theories appal you, my heresies outrage you,
 I never answer letters and you don't like my tie."  - The Doctor

Re: CSS validation Q

Paul F. Johnson wrote:

Quoted text here. Click to load it

Do you mean you are trying to do something like this?

#sidebar {
    a:link { color: red; }

If so, then you should look st the CSS specification for an understanding
of the basic syntax of CSS!

If refer to all links within the #sidebar, do this:

#sidebar a:link {
    color: red;

The only thing that you can "nest" further definitions in is with some of
the @- rules.

Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?id=132

Re: CSS validation Q

Hi Paul F. Johnson,

[Tue, 16 Sep 2003 13:46:51 +0100/Paul F. Johnson]
Quoted text here. Click to load it

It's valid, but you got the warning of not having set a background-
color (fore-/background should be set together)


Site Timeline