Problem with highlighting in table rows

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
MicroBoy
Forum Contributor
Posts: 112
Joined: Sat Mar 14, 2009 5:16 pm

Problem with highlighting in table rows

Post by MicroBoy »

I saw some forms of highlighting in internet, there are a lot of cases, one of them is perfect instead of one thing, with that I can't set the font color. This is the way, but I can't set the font color, if I use class instead of bgcolor, this script doesn't work.

Code: Select all

<tr bgcolor="#FFFFFF" onMouseOver="this.bgColor='gold';" onMouseOut="this.bgColor='#FFFFFF';">
p.s. Is there any simple form like this, but to set the font color too.
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Problem with highlighting in table rows

Post by kaszu »

You can use CSS instead of javascript, but it won't work in IE6.

Code: Select all

... tr td {
    background: #fff;
}
... tr:hover td {
    background: gold;
    color: red;
}
MicroBoy
Forum Contributor
Posts: 112
Joined: Sat Mar 14, 2009 5:16 pm

Re: Problem with highlighting in table rows

Post by MicroBoy »

That's the problem :cry: it is not cross-platform using that form of CSS. I found in Internet that using the above code, the code in CSS will work in IE too, but it caused some design problems of the table:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Re: Problem with highlighting in table rows

Post by kaszu »

You can fix :hover for IE6 using this http://www.xs4all.nl/~peterned/csshover.html, then it will be cross-browser.
Post Reply