我想制作一张食物和营养表,但是有一个问题。无论我做什么宽度的<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