n代表具体的第n个元素,2n+1则代表偶数,2n+1代表奇数,以此类推,3n、3n+1......
一、nth-child(n)用于根据标签名称筛选:n从0开始,如:
td :nth-child(0) {
width: 1%;
}
tr:nth-child(1),
tr:nth-child(4) {
background: #02a7f0;
color: white;
}
二、nth-of-type(n)用于根据类名筛选:n从1开始,如:
/deep/ .el-tabs__item:nth-of-type(3) {
border-left: 1px solid red !important;
}
//双行加底色
.row-bg:nth-of-type(2n) {
background-color: red;
}