#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    84
    Rep Power
    11

    No CSS border on <TR>?


    I would love to encapsulate one of my table rows in a border but my attempts to do so have been less than forthcoming. Here is the CSS code I'm using:

    .propList {
    padding : 2px;
    border-style : solid;
    border-color : black;
    border-width : 1px;
    background-color : #cc9;
    font-size : 10px;
    }

    .thickBorder {
    border-style : solid;
    border-width:2 px;
    border-color : black;
    }

    Here is my HTML code:

    <table border=0 width=100% align=center cellpadding='0' cellspacing='0' class='propList'>
    <tr class='thickBorder'>
    .
    .
    .
    </tr>
    </table>

    (This is actually being echoed from PHP but that's irrelevant.) The problem, as you may have guessed, is that no border actually shows itself.

    Now the likelihood of this being a stupid mistake borne of my ignorance regarding CSS, represents a fairly high probability.

    Thanks for any help,
    Tim
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    804
    Rep Power
    101
    The border style you are defining is only affecting the outer table border. And apparently a TR element does not have a border property. To define the border on the td elements, obviously you could put a class definition in each td elemtent, but I thought that would be redundant and should not be necessary. I was up against a wall until I found some info that led me to do something like this:
    Instead of defining your .thickBorder class, you need to define the thickBorder td element. So, change your line
    Code:
    .thickBorder {
    into
    Code:
    .thickBorder td {
    It should work then. Notice that if you are using styles that do work for TR, you will probably want to leave them applied to the TR and not to TD elements, since, for example, background would leave space inbetween cells if there were any cellspacing. So then you would need two definitions, one for ".thickBorder" to be applied to TR, and one for ".thickBorder td" to be applied to TD.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    84
    Rep Power
    11
    Thanks for your reply. I thought to try assigning to TD but then I'd get a border between each cell as well. Oddly enough, though, I managed to get the TR border working on another page somehow, just not on this one. Guess I'm a sporadic genius.

    Thanks again,
    Tim
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    804
    Rep Power
    101
    You could always nest the entire row in another table, and put a border attribute on either the TD it was in or the new table itself... but I would think there should be a "cleaner" way to do it. Oh well.

IMN logo majestic logo threadwatch logo seochat tools logo