我已经看到了一些关于第一个 child 的问题,但我似乎无法解决任何问题。 我有一个表格,希望第一列全部为粗体,但其余文本为正常。
关于我的表:
div.article table{
/* formatting stuff */
}
div.article table th {
/* formatting */
}
div.article table tr {
/* more formatting. I've got a funky looking table. */
}
然后我尝试:
div.article table tr:first-child {
font-style:bold;
}
不过好像没有影响。
有什么想法吗?我怀疑它真的很小,但我忽略了它。
最佳答案
你应该使用:
div.article table tr td:first-child {
font-weight: bold;
}
通过当前设置的方式,您指定作为 table
的 first-child
的行应该具有其 font-style
设置为 粗体
。那里有 2 个问题,您应该使用 font-weight
而不是 font-style
,并且您想要针对所有 td
这是他们所在行的 first-child
。
关于css - 第一个 child CSS 表格的麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16494004/