当前位置: 首页 CSS CSS 选择前几个元素

CSS 选择前几个元素

选择前几个元素主要使用 CSS3 :nth-child() 选择器

选择前3个div元素

div:nth-child(-n + 3) {
  margin-top: 12px;
}
上一篇:没有了 下一篇:没有了