如何使用nth-child()-selector在html表中选择第1行,然后选择第4行? [英] How do i select the 1st and then every 4th row in a html-table with nth-child()-selector?

查看:127
本文介绍了如何使用nth-child()-selector在html表中选择第1行,然后选择第4行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我承认数学不是我的强项.

Ok, math isn't my strong side, I admit it.

我要做的就是在html表中选择第一,第五,第九,第十三,第十七等行.任何具有较高数学技能的人都可以向我指出正确的方向,或者可以提供第n个傻瓜孩子"指南吗?

All I want to do is to select the first, 5th, 9th, 13th, 17th etc row in a html-table. Can anybody with better math-skills point me in the right directionor perhaps supply a "nth-child-for-dummies" guide?

我尝试了nth-child(1n + 4)(它选择了第四行,之后的每个人),我也尝试了nth-child(0n + 4),它选择了第四行,之后没有任何选择.

I tried nth-child(1n+4) (which selects the 4th row and everyone after), and i also tried nth-child(0n+4) which selects the fourth row and nothing after that.

推荐答案

应该像

tr:nth-child(4n+1) {
  declarations
}

这篇关于如何使用nth-child()-selector在html表中选择第1行,然后选择第4行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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