我有以下 CSS:
table.Table12 { border:1px solid blue; }
table.Table12 td { border:1px solid blue; width:200px;}
table.Table12 a:link{ font-weight: bold;}
和下面的html代码:
<table class="Table12" align="right">
<tr><td><a href="http://www.example.com/test1.php">test1</a></td>
<td><a href="http://www.example.com/test2.php">test2</a></td></tr>
<tr><td><a href="http://www.example.com/test3.php">test3</a></td>
<td><a href="http://www.example.com/test4.php">test4</a></td></tr>
</table>
一切正常,我将所有表格设置为粗体; 我只需要在CSS中将“test3”的字体更改为普通字体即可; 这可能吗?
最佳答案
在 CSS 中尝试一下:
table.Table12 td:nth-child(3) { font-weight: normal; }
算了...没有考虑你的CSS代码的最后一行。 这个效果很好:
table.Table12 tr:nth-child(2) td:nth-child(2) a { font-weight: normal; }
有关 nth-child
语法的更多详细信息,您可以在此处找到:How can I get the second child using CSS?
关于html - 更改 CSS 中的表格字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25518382/