前端1px解决方案

取自vux源码,链接

vux-1px,
.vux-1px-t,
.vux-1px-b,
.vux-1px-tb,
.vux-1px-l,
.vux-1px-r {
  position: relative;
}
.vux-1px:before {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 200%;
  border: 1px solid #C7C7C7;
  color: #C7C7C7;
  height: 200%;
  transform-origin: left top;
  transform: scale(0.5);
}
.vux-1px-t:before {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 1px;
  border-top: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 0 0;
  transform: scaleY(0.5);
}
.vux-1px-b:after {
  content: " ";
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  height: 1px;
  border-bottom: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 0 100%;
  transform: scaleY(0.5);
}
.vux-1px-tb:before {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 1px;
  border-top: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 0 0;
  transform: scaleY(0.5);
}
.vux-1px-tb:after {
  content: " ";
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  height: 1px;
  border-bottom: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 0 100%;
  transform: scaleY(0.5);
}
.vux-1px-l:before {
  content: " ";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  bottom: 0;
  border-left: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 0 0;
  transform: scaleX(0.5);
}
.vux-1px-r:after {
  content: " ";
  position: absolute;
  right: 0;
  top: 0;
  width: 1px;
  bottom: 0;
  border-right: 1px solid #C7C7C7;
  color: #C7C7C7;
  transform-origin: 100% 0;
  transform: scaleX(0.5);
}
  1. vux-1px-l 左边框
  2. vux-1px-r 右边框
  3. vux-1px-t 上边框
  4. vux-1px-b 下边框
  5. vux-1px-tb 上下边框
  6. vux-1px 全边框

谷歌字体不支持12px以下字体显示

.small-font{
  font-size: 12px;
  -webkit-transform: scale(0.5);
}
.smallsize-font{
  Font-size: 6px;
}

<p class=“small-font samllsize-font”>温馨提示</p>

缩放会整体缩放 里面的背景图也会缩放,并且这个属性只能在可设宽高的元素上生效