如果我有一个table包含两列的,我如何指定apadding或任何其他CSS以便仅将其应用于<td>s的第一列。另外,我如何样式化第n列?
Answers:
这应该有所帮助。它的CSS3:first-child,您应该在其中说出tr要设置样式的表的第一个。http://reference.sitepoint.com/css/pseudoclass-firstchild
tr特定表,你可以把.tableclass tr:first-child或#tableid tr:first-child
:first-child在CSS3中不是新手。
要选择表的第一列,可以使用以下语法
tr td:nth-child(1n + 2){
padding-left: 10px;
}