美文网首页工作生活
CSS: nth-child()选择前几个元素

CSS: nth-child()选择前几个元素

作者: 文朝明 | 来源:发表于2019-07-04 12:07 被阅读0次

使用


:nth-child(-n+3){
    margin-top: 12px;
}

选择前几个元素


/*【负方向范围】选择第1个到第6个 */


:nth-child(-n+6){}

从第几个开始选择


/*【正方向范围】选择从第6个开始的 */

:nth-child(n+6){}
/*【限制范围】选择第6个到第9个,/

:nth-child(-n+9):nth-child(n+6){}

相关文章

网友评论

    本文标题:CSS: nth-child()选择前几个元素

    本文链接:https://www.haomeiwen.com/subject/wnplhctx.html