CSS validation Q

P

Paul F. Johnson

Hi,

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

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?

TTFN

Paul
 
R

rf

Paul F. Johnson said:
Hi,

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

a:link {color: red;}

Perfectly valid. There must be something else wrong.
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?

Er, what?

The URL is now required.

Cheers
Richard.
 
S

Steve Pugh

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

a:link {color: red;}

When I pass this through the validator at w3c, I find that I cannot do
this.

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;}.
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?

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 {}
or
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.

Steve
 
T

Toby A Inkster

Paul said:
Are the likes of a:link top level (i.e. global)

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.
 
M

Michael Weber

Hi Paul F. Johnson,

[Tue, 16 Sep 2003 13:46:51 +0100/Paul F. Johnson]
Hi,

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

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?

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


regs
michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top