伪类选择器
a标签有四种伪类,建议顺序 link visited hover active
:hover
:link 链接前
:visited 链接后
:active
:focus 获取焦点
:first-child 只能是第一个,是第一个子级元素
:first-of-type 第一个 类型的标签, 不用是第一个
:nth-of-type()
伪元素
::before
::after
::first-line
::first-letter
::placeholder
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>伪元素</title>
<style>
p{
color: skyblue;
}
p::before{
content: "大家好";
color: orange;
}
p::after{
content: "欢迎大家学习c1";
color: tomato;
}
div{
width: 200px;
}
div::first-line{
color: tomato;
}
div::first-letter{
font-size: 40px;
}
input::placeholder{
color: pink;
}
</style>
</head>
<body>
<p>策哥</p>
<div></div>
<input type="text" placeholder="我就是个测试的工具">
</body>
</html>