用伪类选择器 在元素前面加一条线

话不多说,先看效果图

 

文章 我用的是h2标签,话不多说 直接上代码

h2{
  font-weight: bold;
  position: relative;
  padding-left: 16px;
  &::before{
    content:""; 
    width: 5px; 
    height:20px; 
    border-radius: 12px;
    position: absolute; 
    top: -2px; 
    left: 0; 
    background: #1d52ad;
	}
}

猜你喜欢

转载自blog.csdn.net/cwb_2120/article/details/131069122
今日推荐