小程序 first-child失效 使用:nth-child(2)应用到了第一个子元素 ,原因(存在兄弟节点 即使类名不一样)如下图 ruleTitle为gift的兄弟节点
小程序 first-child 和 last-child 会失效的原因
设置first-child伪类时我们看第一个的前面有没有兄弟节点,
设置last-child伪类时看最后一个有没有兄弟节点。
所以要设置这种伪类时如果没有起到效果,我们可以先看一下他有没有同级的兄弟节点

相关文章:

  • 2022-12-23
  • 2021-08-12
  • 2022-12-23
  • 2021-06-11
  • 2022-12-23
  • 2021-08-08
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案