42

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> 
1

3 Answers 3

62

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>

Sign up to request clarification or add additional context in comments.

4 Comments

first of all you found the solution so I'm accepting your answer
Why does it have to be collapsed? @toscho
OK, yeah :D - I asked the wrong question :) What does collapsing the table mean/do?
@cullub I have added a link to the spec. It is explained with illustrations there.
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

2 Comments

@metal-gear-solid: What exactly are you trying to achieve? Can you describe the visual result you wish to see?
@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?
2

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} 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.