我的一个场景就是,一个空的div,但是想加个背景颜色,方案就是在div加个空content,利用before属性加上背景
<div class="hilan"></div>
.hilan {
  position: relative;
  padding-right: 12px;
}
.hilan:before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  background: black;
  -webkit-border-radius: 100%;
  -moz-border-radius: 100%;
  border-radius: 100%;
  position: absolute;
  top: 8px;
  left: 0;
}

  

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-07-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-02-07
相关资源
相似解决方案