设置第一个< td>列的表 [英] Style the first <td> column of a table differently

查看:115
本文介绍了设置第一个< td>列的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有两个列的,如何指定 padding 或任何其他css,它仅适用于< td> 的第一列。同样,如何以类似方式设置 第n个 列?

If I have a table with two columns, how do I specify a padding or any other css so that it is applied just for the first column of <td>s. Also how do I style an n-th column similarly?

推荐答案

您可以使用第n个子选择器

以定位您可以使用的第n个元素:

to target the nth element you could then use:

td:nth-child(n) {  
  /* your stuff here */
}

这篇关于设置第一个&lt; td&gt;列的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆