2016-11-13 3 views
0

thead에있는 tr에 모두 테두리를 적용하려고합니다.CSS 테두리가 보이지 않지만 CSS가 적용됩니다.

CSS는 (스타일러스) : 스타일을 크롬에 따르면

table 
    thead 
     tr 
      border: solid #000; 
      border-width: 0 10px; 

적용받을 있지만, 국경이 실제로 표시되지 않습니다 : enter image description here

+0

링크를 작동하기 위해 table은 테두리 border-collapse: collapse이 필요합니다 .asp? filename = tryhtml_tbody –

+0

'table' 또는'td'에 적용 해보십시오. 그게 효과가 있니? –

+0

'tr'은 경계선이 작동하기 위해'border-collapse : collapse'를'table'에 필요로하고, 사용할 수 없을 때는'td'에 설정합니다 – LGSon

답변

1

tr

table.first { 
 
    border-collapse: separate;  /* property default */ 
 
} 
 
table.second { 
 
    border-collapse: collapse; 
 
} 
 

 
table thead tr { 
 
    border-bottom: 2px solid gray; 
 
} 
 

 
/* for this demo only */ 
 
div { 
 
    margin: 25px 20px 10px; 
 
    text-decoration: underline; 
 
}
<div>This table's tr (in thead) has no border</div> 
 

 
<table class="first"> 
 
    <thead> 
 
    <tr> 
 
     <td>Left Head</td> 
 
     <td>Right Head</td> 
 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
    <tr> 
 
     <td>Left</td> 
 
     <td>Right</td> 
 
    </tr> 
 
    </tbody> 
 
</table> 
 

 
<div>This table's tr (in thead) has border</div> 
 

 
<table class="second"> 
 
    <thead> 
 
    <tr> 
 
     <td>Left Head</td> 
 
     <td>Right Head</td> 
 
    </tr> 
 
    </thead> 
 
    <tbody> 
 
    <tr> 
 
     <td>Left</td> 
 
     <td>Right</td> 
 
    </tr> 
 
    </tbody> 
 
</table>

+0

고마워요! :디 – g3mini

0

thead {color:green;} 
 
tbody {color:blue;} 
 
tfoot {color:red;} 
 

 
table, th, td { 
 
    border: 1px solid black; 
 
}
<table> 
 
    <thead> 
 
    <tr> 
 
     <th>Month</th> 
 
     <th>Savings</th> 
 
    </tr> 
 
    </thead> 
 
    <tfoot> 
 
    <tr> 
 
     <td>Sum</td> 
 
     <td>$180</td> 
 
    </tr> 
 
    </tfoot> 
 
    <tbody> 
 
    <tr> 
 
     <td>January</td> 
 
     <td>$100</td> 
 
    </tr> 
 
    <tr> 
 
     <td>February</td> 
 
     <td>$80</td> 
 
    </tr> 
 
    </tbody> 
 
</table>

0

나는 CSS 마스터가 아니지만 일반적으로 테두리 속성을 써야합니다. n은 한 줄 : -http : //www.w3schools.com/tags/tryit

border: 10px solid #000;