Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS Syntax... Links within ID 1

Status
Not open for further replies.

Nevermoor

Programmer
Jul 25, 2003
218
US
Ok, there must be some way to do this, but I'm trying to define a style for all links within code segments with a certain ID. In a row like this:
Code:
<tr id=&quot;butnBlue&quot;>
	<td width=&quot;33%&quot;><a href=&quot;#null&quot;>Address</a></td>
	<td width=&quot;34%&quot;><a href=&quot;#null&quot;>Street</a></td>
	<td width=&quot;33%&quot;><a href=&quot;#null&quot;>CNN</a></td>
</tr>

I'd like the links to have the following style:
	 a       { color: #FFA500;}
	 a:hover {color:#FF3366; text-decoration:none;}
I can't simply do a#butnBlue though as the links are not in the tr and the style does not take. Is there some syntax I am missing or do I have to give each of those links an ID?

Thanks in advance

-Nm
 
dreadlord:no you don't - there are a few ways of applying css styles only to nested id/element tags like nevermoor wants to.

nevermoor:
See Pattern Matching here (official W3C CSS2 standars doc):

For your particular problem you can use:
Code:
#butnBlue a       { color: #FFA500;}
#butnBlue a:hover {color:#FF3366; text-decoration:none;}

the space means matching when the second element is a descendent of the first. It will work for your case. Check the W3C page for more matching things you can do.. I've been able to do some pretty complex conditional CSS with it.

best of luck

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
That's exactly what I was looking for. Must have been too overcome with monday to find it.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top