CSS hyperlinks and tables

W

W. Paulisse

hy,

I want to have the following with CSS:

- on the entire page a hyperlink should be red. <-- no problem here ^-^
- In specific TD's the color should be green. <-- THAT'S the problem

How can i specify in the TD's stylesheet to make an ancor a different color?

Thanks in Forward
Wouter
 
W

W. Paulisse

ow, btw. i forgot 1 MAJOR detail

I could afcourse make use of an seperate class in the ancors in the table
(<a class=....). but that is something i would like to avoid.
 
N

Nik Coughin

W. Paulisse said:
ow, btw. i forgot 1 MAJOR detail

I could afcourse make use of an seperate class in the ancors in the
table (<a class=....). but that is something i would like to avoid.

You could do:

td a
{
color: green;
}

However, this would make all links that appeared inside a td tag green. If
you only want to do it in a specific table try:

..greenlink a
{
color: green;
}

then give the table itself greenlink as a class.
 
R

Richard

W. Paulisse said:
I want to have the following with CSS:
- on the entire page a hyperlink should be red. <-- no problem here ^-^
- In specific TD's the color should be green. <-- THAT'S the problem
How can i specify in the TD's stylesheet to make an ancor a different
color?
Thanks in Forward
Wouter

http://www.w3.org/TR/REC-CSS2/selector.html#dynamic-pseudo-classes

A:link { color: red } /* unvisited links */
A:visited { color: blue } /* visited links */
A:hover { color: yellow } /* user hovers */
A:active { color: lime } /* active links */

That's the actual syntax for the css.

A {
color:red;
font-family:sans-serif;
font-weight:bold;
font-size:14pt;
text-decoration:none;
}

Another method of doing it for all.

There is no <a class="ID" href="#"> just <a href="#">
 
N

Nik Coughin

Richard said:
here ^-^ > - In specific TD's the color should be green. <-- THAT'S
the problem

different > color?

A:link { color: red } /* unvisited links */
A:visited { color: blue } /* visited links */
A:hover { color: yellow } /* user hovers */
A:active { color: lime } /* active links */

That's the actual syntax for the css.

A {
color:red;
font-family:sans-serif;
font-weight:bold;
font-size:14pt;
text-decoration:none;
}

Another method of doing it for all.

There is no <a class="ID" href="#"> just <a href="#">

What are you on about?

He knows how to change the color of anchors globally (which is what the css
you listed above does), as clearly stated in his post. He was asking
specifically how to make only links that appear inside a td tag a different
color.

What do you mean by "There is no <a class="ID" href="#"> just <a href="#">?
You can assign a class to an anchor tag. You can assign a class to any tag.
This is perfectly valid:

..greenlink
{
color: green;
}

....

<a class="greenlink" href="#">An Anchor</a>

Although he did mention that he didn't want to do it this way.
 

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

Forum statistics

Threads
473,765
Messages
2,569,568
Members
45,042
Latest member
icassiem

Latest Threads

Top