例如:
html文件
<p class="title">
{{title}}
</p>
css样式
.title {
margin-top: 15px;
font-size: 16px;
font-weight: 600;
color: #333333;
padding-left: 10px;
position: relative;
}
.title:before {
content: '';
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
-webkit-transform: translateY(-50%);
height: 100%;
width: 4px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background-color: #2688E8;
}
这样就完成了