2013-05-11 104 views
0

我已经看到关于第一个孩子的其他一些问题,但我似乎无法获得任何工作。 我有一张桌子,并且希望第一列全部为粗体,但其余部分为正常。第一个孩子的css表问题

关于表我有

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; 
} 

,但它似乎并没有产生影响。

任何想法?我怀疑它确实很小,但我忽略了它。

+0

你可以显示你的html的一部分吗? – 2013-05-11 05:19:12

回答

4

你应该使用:

div.article table tr td:first-child { 
    font-weight: bold; 
} 

带着它设置了当前正在指定这是tablefirst-child行应该有它font-style设置为bold的方式。这里有两个问题,你应该使用font-weight而不是font-style,并且你想要定位所有td的行,它们是first-child

+1

它的字体重量,而不是字体样式 – 2013-05-11 05:19:12

+0

哦,上帝。字体重量/风格。这是愚蠢的小东西*沉入地下* – 2013-05-11 05:23:47

+0

这不是唯一的问题,如果你想要定位第一列,你必须将其更改为'div.article table tr td:first-child' 。 – 2013-05-11 05:25:07