Highlight selected row using css
How we can highlight开发者_JS百科 selected row in a table using css. Is there any way to do that?
Assuming that by "selected" you mean "hovered over by mouse":
tr:hover {background-color: #FF0000}
You could also highlight with things like 'font-weight:bold', 'color: #FF000', etc..
tr { background: sky-blue-pink } /* Use a real colour */
tr * { background: transparent; }
where tr
is a more specific selector to indicate whatever condition you have in the DOM to represent 'selected'. This will probably be a class selector: tr.selected
You just have to do something like:
tr:hover { background: #FCF; }
See this example.
CSS part:
table.rowHover tr:hover{ background-color: #ccc; }
apply class = "rowHover" on the table
cheers !!!
精彩评论