2021.01.23css3选择器
作者:互联网
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/* div:nth-child(10){
color:red
} */
/* div:nth-of-type(2){
color: pink;
} */
/* div:nth-child(3n){
color:green
} */
div:nth-child(odd){
color:green
}
p:nth-of-type(2){
color:red
}
</style>
</head>
<body>
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<!-- <p>女同学</p> -->
<div>男同学</div>
<div>男同学</div>
<div>男同学</div>
</body>
</html>
<!--
css3的结构选择器
- 当前标签集合:nth-child(){}
- n 数字 第几个的意思
- 当前标签只能是同种类型标签
- 2n,3n都是倍数 even偶数 odd基数
- 当前标签集合:nth-of-typr(){}
- 现在不同的类型标签中找到集合,然后再集合中找到第几个
-->
标签:2021.01,nth,--,color,div,23css3,女同学,选择器,男同学 来源: https://blog.csdn.net/m0_54087529/article/details/113531701