使用伪元素向页面小图标
1. html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="Pseudo-classes_and_pseudo-elements.css" >
<title>Title</title>
</head>
<body>
<p class="box">Content in the box in my HTML page.</p>
<p class="box"></p>
</body>
</html>
2. css
.box::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
background: url("right.jpeg") no-repeat center center;
background-size: 10px;
}
3. 效果: