scss 定制虚线边框css

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scss 定制虚线边框css相关的知识,希望对你有一定的参考价值。

@mixin dotted($col,$w,$h) {
  background-image: -webkit-gradient(linear, left top, right top, color-stop(50%, $col), color-stop(0%, rgba(255, 255, 255, 0))), 
  -webkit-gradient(linear, left top, left bottom, color-stop(50%, rgba(255, 255, 255, 0)), color-stop(0%, $col)),
  -webkit-gradient(linear, left top, right top, color-stop(50%, rgba(255, 255, 255, 0)), color-stop(0%, $col)),
  -webkit-gradient(linear, left top, left bottom, color-stop(50%, $col), color-stop(0%, rgba(255, 255, 255, 0)));
  background-image: -webkit-linear-gradient(left, $col 50%, rgba(255, 255, 255, 0) 0%), 
  -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 50%, $col 0%),
  -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 50%, $col 0%),
  -webkit-linear-gradient(top, $col 50%, rgba(255, 255, 255, 0) 0%);
  background-image: -o-linear-gradient(left, $col 50%, rgba(255, 255, 255, 0) 0%), 
  -o-linear-gradient(top, rgba(255, 255, 255, 0) 50%, $col 0%),
  -o-linear-gradient(left, rgba(255, 255, 255, 0) 50%, $col 0%),
  -o-linear-gradient(top, $col 50%, rgba(255, 255, 255, 0) 0%);
  background-image: linear-gradient(to right, $col 50%, rgba(255, 255, 255, 0) 0%), 
  linear-gradient(to bottom, rgba(255, 255, 255, 0) 50%, $col 0%),
  linear-gradient(to right, rgba(255, 255, 255, 0) 50%, $col 0%),
  linear-gradient(to bottom, $col 50%, rgba(255, 255, 255, 0) 0%);
  background-position: top, left, bottom, right;
  background-size: $w $h, $h $w,$w $h, $h $w;
  background-repeat: repeat-x, repeat-y, repeat-x, repeat-y;
}

以上是关于scss 定制虚线边框css的主要内容,如果未能解决你的问题,请参考以下文章

css控制边框虚线的长度或者间隔

css 删除虚线边框/发光链接

CSS 摆脱链接的虚线边框

css去除buttonainput标签的虚线边框

css IE下设置字段集的边框为虚线

CSS 摆脱FF中链接的虚线边框;使用图像替换技术