css——三角标签实现

参考:https://blog.csdn.net/whqet/article/details/8881957

效果:

html:

 <span class="s-triangle"><i class="triangelTag">9.0折</i></span>

css:

.s-triangle {
  display: inline-block;
  font-size:12px;
  margin-left: 15px;
  position: relative;
}

.triangelTag {
  display: block;
  background-color: #ffdd00;
  height: 20px;
  line-height: 20px;
  padding: 0 10px 0 12px;
  position: relative;
}

.triangelTag:before {
  content: " ";
   0px;
  height: 0px;
  position: absolute;
  top: 0;
  left: -20px;
  border: 10px solid transparent;
  border-right-color: #ffdd00;
}
原文地址:https://www.cnblogs.com/linjiangxian/p/12625342.html