38

CSS

table tr {border-bottom:1px solid #008999}

HTML

<table width="100%" cellspacing="0" cellpadding="0">
   <thead>
      <tr>
         <th scope="col">one</th>
         <th scope="col">two</th>
         <th scope="col">three</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <th scope="row">Hello</th>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
      </tr>
   </tbody>
</table>
Jitendra Vyas
  • 148,487
  • 229
  • 573
  • 852
  • Duplicates: http://stackoverflow.com/questions/670424/border-around-specific-rows-in-a-table http://stackoverflow.com/questions/583539/set-border-to-table-tr-works-in-everything-except-ie-6-7 http://stackoverflow.com/questions/2238174/border-bottom-for-ie-is-not-working-in-tr – Jørn Schou-Rode Apr 10 '10 at 09:19

3 Answers3

55

Add:

table
{
    border-collapse: collapse;
}

Otherwise tr creates no single block.

Simple example:

table
{
  border: 5px solid #900;
  background: #fff;
}
tr
{
  border: 5px solid #090;
}
td
{
  background: #ccc;
  padding: 5px 0;
}

table + table
{
  border-collapse: collapse;
}
<table>
  <tr>
    <td>def</td>
    <td>ault</td>
  </tr>
</table>
<table>
  <tr>
    <td>coll</td>
    <td>apse</td>
  </tr>
</table>
fuxia
  • 62,923
  • 6
  • 54
  • 62
9

Try giving

table tr th {border-bottom:1px solid #008999}

Then you can use

table { border-collapse: collapse; }
table tr {border-bottom:1px solid #008999; }

See The collapsing border model

rahul
  • 184,426
  • 49
  • 232
  • 263
  • @metal-gear-solid: What exactly are you trying to achieve? Can you describe the visual result you wish to see? – Raul Agrait Apr 08 '10 at 05:21
  • @raul - see this `table tr {border-bottom:1px solid #008999}` it means every `TR` in `table` should have border with `1px` height `solid` and in this color `#008999`. What is not clear? – Jitendra Vyas Apr 08 '10 at 05:23
3

tr by definition wont take border styles. You need to apply it to the td's within it:

table tr td {border-bottom:1px solid #008999}
sandyiit
  • 1,597
  • 3
  • 17
  • 23