用css为表中的最后一个td设置样式 [英] Styling the last td in a table with css
本文介绍了用css为表中的最后一个td设置样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< table> ;
< tbody>
< tr>
< td>一< / td>
< td>两个< / td>
< td>三< / td>
< td>四< / td>
< td>五< / td>
< / tr>
< / tbody>
< / table>
表td
{
border:1px solid black;
}
我希望包含文本Five的TD没有边框,
解决方案
您可以使用相对规则:
表td + td + td + td + td {
border:none;
}
只有在运行时没有确定列数的情况下才有效。 / p>
I want to style the last TD in a table without using a CSS class on the particular TD.
<table>
<tbody>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
<td>Five</td>
</tr>
</tbody>
</table>
table td
{
border: 1px solid black;
}
I want the TD containing the text "Five" to not have a border but again, I do not want to use a class.
解决方案
You can use relative rules:
table td + td + td + td + td {
border: none;
}
This only works if the number of columns isn't determined at runtime.
这篇关于用css为表中的最后一个td设置样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文