Jump to content

hover style for only parts of a webpage


htmlnewbie23

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...