css - weui 用伪元素生成border,源码有点不理解
巴扎黑
巴扎黑 2017-04-17 11:44:02
0
5
943
    
.weui_actionsheet_cell {
  position: relative;
  padding: 10px 0;
  text-align: center;
  font-size: 18px;
}
.weui_actionsheet_cell:before {
      content: " ";
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 1px;
      border-top: 1px solid #D9D9D9;
      color: #D9D9D9;
      -webkit-transform-origin: 0 0;
              transform-origin: 0 0;
      -webkit-transform: scaleY(0.5);
              transform: scaleY(0.5);
}

我想知道为什么weui中,利用伪元素生成border,同时使用了border:1px和height:1px;,然后又在Y轴上缩放0.5倍。我觉得直接用border不久可以了,应该没有那个浏览器不支持border的吧。
巴扎黑
巴扎黑

reply all(5)
伊谢尔伦

In order to adapt to the 1px border problem of high-definition screens and retina screens. Use transform scale y to solve it in one go. The advantage of using pseudo-elements is that there are no more useless p tags.

阿神

If there is only width but no height, the height should be given here just for better display~to avoid the situation that it cannot be displayed~~This should be for the border width of 1px, first give the height of 1px, and then give Scale the Y axis back ~ it should be a line in the end.

洪涛

In order to solve the 1px border problem of retina screen

小葫芦

Don’t talk, look at the pictures

刘奇

To achieve 0.5px border

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template