1.伪类选择器
eg: a:link{} a:visited{} a:hver{} a:activer{} 注意a标签的四个属性一定要按照顺序写,不能颠倒,简单的记忆方法“lvha”
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>伪类选择器</title>
<style>
div{width:100px;
height:100px;
margin:100px auto;
border:1px solid blueviolet;
}
div a{
display: block;
width:50px;
height: 50px;
}
div a:link{background:white}
div a:visited{background: blue}
div a:hover{background:red;}
div a:active{background:black;}
</style>
</head>
<body>
<div>
<a href=""></a>
</div>
</body>
</html>
2.伪元素选择器
eg:(::afer ::before)(注意:在使用伪元素选择器时属性中一定要加上content:'';即使空值也要加上,然后使用定位。)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>伪元素选择器</title>
<style>
div{width:100px;
height: 100px;
background:springgreen;
margin:100px auto;
position: relative;
}
div::after{
content:'11';
width:20px;
height:20px;
border-radius:50%;
background:red;
color:sienna;
position:absolute;
top:-10px;
right:-10px;
}
</style>
</head>
<body>
<div>
</div>
</body>
</html>