指尖上的记忆指尖上的记忆
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub
首页
  • 基础
  • Laravel框架
  • Symfony框架
  • 基础
  • Gin框架
  • 基础
  • Spring框架
  • 命令
  • Nginx
  • Ai
  • Deploy
  • Docker
  • K8s
  • Micro
  • RabbitMQ
  • Mysql
  • PostgreSsql
  • Redis
  • MongoDb
  • Html
  • Js
  • 前端
  • 后端
  • Git
  • 知识扫盲
  • Golang
🌟 gitHub

项目中经常会有短竖线分隔多个元素的设计,下面记录一下实际开发中用的比较多的一种


<div class="test">hello</div>

.test
	width 100px
	height 50px
	background #eee
	position: relative;
.test:after
	content: ''
	height: 20px
	border-right: 2px solid red
	position: absolute;
	right: 0;
	top: 13px;
	
实际项目中的用法(去掉最后一个为元素的竖线以及margin值):
.st-item{
      width: 4.25rem;
      height: 1.4rem;
      font-weight: 400;
      font-size: 0.875rem;
      line-height: 1.4rem;
      position: relative;
      margin-right: 1.25rem;
      &:after{
        content: '';
        height: 1.25rem;
        border-right: 0.0625rem solid #000;
        position: absolute;
        right: 0;
        top: 0.0625rem;
      }
      &:last-child{
        margin-right: 0;
      }
      &:last-child:after{
        display: none;
      }
    }