3

Here is my Stylesheet

<style>
table tr{ border:1px solid #F00 ;  }
table td{ padding:20px; }
</style>    

Here is a HTML CODE :

<table class="" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td>Test</td>
    <td>testing</td>
</tr>
</table>

Here is a Fiddle link for live preview. http://jsfiddle.net/Husen/tL7wK/

Husen
  • 955
  • 1
  • 6
  • 16

3 Answers3

9

Remove the tables border attribute.

Add border-collapse: collapse; to your CSS. This will allow a border for the tr :)

table {
  border-collapse: collapse;
}

table tr {
  border: 1px solid #F00;
  border-top: 1px solid #0F0;
}

table td {
  padding: 20px;
}
<table>
  <tr>
    <td>Test</td>
    <td>testing</td>
  </tr>
</table>
misterManSam
  • 24,303
  • 11
  • 69
  • 89
  • Amazing!!! this works fine, but not compatible with IE7 :(, but, works well with rest browsers. Do you have hack or code for IE7? – Husen Jun 05 '14 at 07:00
  • Not working , but, i've find a solution like this : http://jsfiddle.net/Husen/tL7wK/11/ – Husen Jun 05 '14 at 07:21
3

You need to add border to td for example:

<style>
table td{ padding:20px; border:1px solid #F00 ; }
</style>   

DEMO

Or you can add border to the table: like this:

table{ border:1px solid #F00 ;  }
table td{ padding:20px; }

DEMO2

If you want only row border effect you can try this:

table td{
    border-top: 1px solid red;
    border-bottom: 1px solid red;
    padding:20px; 
 }

 table{ border:1px solid #F00 ;  }

DEMO3

misterManSam
  • 24,303
  • 11
  • 69
  • 89
Alessandro Minoccheri
  • 35,521
  • 22
  • 122
  • 171
1

try something like this

table td{ border:1px solid #F00 ;padding:20px;  }
rajesh kakawat
  • 10,826
  • 1
  • 21
  • 40