CSS 数量查询

Avatar of Chris Coyier
Chris Coyier

DigitalOcean 为您旅程的每个阶段提供云产品。 立即开始使用 $200 免费信用额度!

Heydon Pickering 提出了一些巧妙的 CSS 选择器,例如

li:nth-last-child(n+6),
li:nth-last-child(n+6) ~ li {
  /* Selects all list items if there are 6 or more */
}

类似于 Matt Mastracci 的 文章,他专注于针对特定数字组的样式。

直接链接 →