Grow your CSS skills. Land your dream job.

Border on an individual table row (tr) ?

  • # July 26, 2008 at 10:07 pm

    Hi all,

    I’m trying to dynamically give a table row a red dashed border whenever a person mouses over it. My jQuery code is this:

    $(‘table#timeline tr’).mouseover( function() {
    $(this).css("border","3px dashed red");
    })

    The jQuery code isn’t important. I know that part works because I’ve used the css function to change the background color instead and that works just fine. However, when I apply it to the table tr’s, the border does not change at all. I also tried changed it with Firebug and that did not seem to work either. Any ideas what might be wrong?

    Thanks all!
    Dave

    # July 27, 2008 at 8:25 pm

    I don’t think table rows accept borders. You’ll need to apply the border to the TD elements instead I believe.

    # August 17, 2008 at 11:06 pm

    Yes, Chris, you’re right. I found out eventually. That kind sucks, but you do have to change the sizes of the individual cells, although jQuery selectors do make that easy :)

    Was used in this greasemonkey script if interested: http://whatthetweet.daves-lab.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".