Is there a way to change the css property for example of a box when an element (inside the ) is hover?
for example if I have:
<table>
<tr><td><a>.....</td></tr>
</table>
I want to change the property of the container td when the link a has the mouse over. Is it possible?
Sorry, I have not explained well.
I have a , not a table…it was only an example….
I have
<ul>
<li><a>.....
in my css I have:
#navigation li a {
text-decoration: none;
color: #333;
text-transform: none;
}
#navigation li:hover {
color: white;
background-color: #333;
}
#navigation li a:hover {
color: white;
background-color: #333;
}
but It does not works because if I go on the link it’s ok, but if I go with the mouse in the li but off the link the color of the text does not change…
That’s because you’re putting the hover on the link itself. If you want the link to react when you mouse over the li, simply change where you put the hover pseudo-class:
This basically says “when the li is hovered, the link inside it should change to these styles.”
Alternatively, you can add padding to the link (ex –
padding: 5px), making its reaction field larger. So:As long as you don’t have your
lielements set to a larger size than theaelement (via height, width, margin, and/or padding), then theliwill “shrink-wrap” theaand be the same size as the total size of the link.