html - 更改 CSS 中的表格字体

标签 html css fonts

我有以下 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/

相关文章:

css - Bootstrap3 列间距

html - 如何让两个div并排放置

html - Firefox 的 iframe 中不显示字体

css - Windows字体问题以及如何为客户调试

javascript - div 随动画滑入,但永远不会滑回

HTML 和正文没有 100% 宽度

html - 我的元素没有填满页面的整个空间

html - 使整个表格成为一个链接

c# - 检查 FontFamily 是否为 TrueType

HTML5 输入类型数字重新格式化长数字