伪元素before

伪元素使用时候的一些坑

by wei liu

HTML

<div class="left">
  <p>只需<span class="three">2</span>步</p>
  <p class="small">轻松赚取第一桶金</p>
</div>

SCSS

$primary: #ff0c0c;
$color: #333333;
p{
  margin: 0
}
.left{
  display: inline-block;
  margin-left: 50px;
  height: 67px;
  line-height: 35px;
  vertical-align: top;
  text-align: left;
  font-size: 30px;
  color: $color;
}
.left:before{
  float: left;
  height: 67px;
  content: '';
  border-right: solid 3px $primary;
  border-left: solid 2px $primary;
  margin-right: 10px;
  /* margin-left: -10px; */
}
.left .three{
  font-weight: 100;
  font-size: 45px;
  background-image: -webkit-gradient(linear, 0 0, 0 bottom, from(#FF0C0C), to(#FDA657));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.small{
  font-size: 18px;
}