我想製作一張食物和營養表,但是有一個問題。無論我做什麼寬度的<td>
和<th>
元素都不會改變。 ..我想我的表看起來相反的THIS無論我做什麼,表格元素都不響應編輯
#table1{
table-layout:fixed;
width:100%;
}
.row1 > th{
border-right:1px solid #ddd;
padding:0.75em;
}
<table id="table1">
<thead>
<tr class="row1">
<th>Foods</th><th>Carbohydrates</th><th>Proteins</th><th>Fats</th><th>Calories Total</th>
</tr>
</thead>
<tbody>
<tr class="row2">
<th>Foods</th><th>Carbohydrates</th><th>Proteins</th><th>Fats</th><th>Calories Total</th>
</tr>
</tbody>
</table>
感謝像this(無頭)。
因爲'.Table1-row1'不存在。你可能意思是'#table1 .row1 th {/ * your th styles * /}'。另外,'th'元素應該只在'thead'中。 – Vucko
對不起,我編輯了片段。這只是一個片段錯誤,當我正在粘貼片段時我正在改變我的課程,並且我忘記在這裏修改它。 – Dako
如果你看看你的snipper,你會發現它正在工作 - 它將樣式添加到'.row1'中的'th'元素。 – Vucko