侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

css – 如何只选择表的第一个colgroup的第一个td?

2022-12-28 星期三 / 0 评论 / 0 点赞 / 30 阅读 / 703 字

如何只选择表的第一个colgroup的第一个td?如果我有5列的表并使用5 colgroup?解决方法 table colgroup:first-child td:first-child 从w3

... . . 如何只选择表的第一个colgroup的第一个td?如果我有5列的表并使用5 colgroup?.

解决方法

. table colgroup:first-child td:first-child

从w3schools开始:

.

Note: For :first-child to work in IE a <!DOCTYPE> must be declared.

.

更新:

正如DisgruntledGoat正确提到的那样,td元素不是colgroup元素的后代.但是第一个colgroup显然总是包含第一列所以这个

table tr td:first-child

选择每行中的第一个td应该这样做.

. . .. ...

广告 广告

评论区