Thursday, February 11, 2010

How to highlight the entire <TR> during mouseover?

For IE, this doctype or similar one is needed:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">



If you use onmouseover+onmouseout to change the style using the method I mentioned before could be painful.

I came across a method which is code saving:- use TR:hover.

First I have this CSS declared:

tr.rowname:hover { background-color: #FF8888; color: #FFF; }


And I used it in HTML:

<tr bgcolor=#FFF1F1 class=rowname><td>blah blah blah</td></tr>



This is so cool as I save a lots of trouble defining onmouseover, onmouseout, ...

No comments:

Post a Comment