Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Nov 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question highlighting table rows

    How can I easily highlight an entire row in
    a table (by changing the background color
    or bold-facing the text) ?

    Thanks a million !
    rudi

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    By putting a style on the <tr> tag for the row.

    <tr style="background-color: #0000FF; color: white;">...</tr>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can set up CSS class for highlighting:

    tr.highlight {
    background-color: #000080;
    color: #ffffff;
    }

    And add mouse events to each row:

    <tr onmouseover="this.className='highlight';"
    onmouseout="this.className='';">

    As long as your TD elements don't have styles set for background or foreground color they will inherit those properties from the TR element.

  • #4
    New to the CF scene
    Join Date
    Nov 2002
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks a lot for your help guys !!!

    Cheers !
    rudi

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    tr:hover{
    background-color:highlight
    }

    Would also do the trick,and its much easier.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Bosko
    tr:hover{
    background-color:highlight
    }

    Would also do the trick,and its much easier.
    As long as your audience is using a Gecko based browser (like Mozilla), of course the IE users wouldn't see any highlights. Unfortunately, while this is the right way to do it you've got to do it that hard way for now if your audience isn't up to date.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That will also work in Konqueror and Opera...

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Bosko
    That will also work in Konqueror and Opera...
    Mozilla + Netscape + Konqueror + Opera =~ 10%-12% of users

    Too bad, since the :hover pseudo-class is SO much easier. Better use the javascript method if you want the bulk of your users to see the effect.

    Note: you could do both by using an HTC for the javascript rollover and the :hover pseudo-class. In both instances the browser would only use the one it supports.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mozilla/Netscape + Konqueror + Opera =~ ?% of users

    It all depends on the site,maybe its 10% for microsoft.com,but I have seen sites where the majority of the users uses Mozilla/Netscape.

    Well,thats the beaty of W3C standards,it allows you to create cool effects very easily

  • #10
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well Bosko, what you say can certainly be true (about the percentage) but I think it's non-controversial to say that that is the exception rather than the rule.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •