::before – 原有内容之前增加
必须设置content:属性值书写要增加的内容
行内元素
::after – 原有内容之后增加
必须设置content:属性值书写要增加的内容
行内元素
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>伪元素</title>
<style type="text/css">
/*
::before 原有内容之前增加
必须设置content:属性值书写要增加的内容
行内元素
*/
p::before{
content: "前面增加";
color: red;
}
/*
::after 原有内容之后增加
必须设置content:属性值书写要增加的内容
行内元素
*/
p::after{
content: "后面增加";
color: red;
}
/* 应用*/
/* 先导符号*/
</style>
</head>
<body>
<p>这是我们的段落</p>
</body>
</html>