htmlnewbie23 Posted December 26, 2007 Share Posted December 26, 2007 I know that if I put <STYLE>a:hover {background:red;color:white;text-decoration:none}</STYLE> (for example) in the head section of a html page, the links will turn red when the mouse hovers over them. I however have a complex html page containing a large table and links inside many separate <tr> tags. Is there a way I can make the hover effect active only within certain <tr> ...... </tr> sections of the table and not others?In other words is there a way I can insert that hover style only within certain <tr> tags but not others, instead of for the entire page?Thank you Link to comment Share on other sites More sharing options...
real_illusions Posted December 26, 2007 Share Posted December 26, 2007 yeah..you need to assign id's to either the links or the tr's.And then give them the seperate styles in the stylesheet.body<a id="link1" href="">link 1</a><a id="link2" href="">link 2</a>stylesheet#link1 a:hover{text-decoration:none;color:#FF0000;}#link2 a:hover{text-decoration:none;color:#0099FF;}that should work anyway...unless i've made a blindingly obvious mistake.. Link to comment Share on other sites More sharing options...
Ingolme Posted December 27, 2007 Share Posted December 27, 2007 Give the <tr> an ID and then use selectors to reference the links:HTML<tr id="something">...<a href="#"></a><a href="#"></a>...</tr>CSStr#something a {background-color: red;color: white;text-decoration: none;} Link to comment Share on other sites More sharing options...
htmlnewbie23 Posted December 27, 2007 Author Share Posted December 27, 2007 Thank you both. Link to comment Share on other sites More sharing options...
killboy Posted December 30, 2007 Share Posted December 30, 2007 You can also assign classes: <style>a.mylink:hover{background:red;color:white;text-decoration:none}</style>...<a class="mylink" href="[URL here]">[text here]</a> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.