css是没办法设置虚线间距的SVG线条是可以设置间距的path {stroke-dasharray: 4;stroke-dashoffset: 22;}CSS 的 border: 1px dashed 虚线的宽
如何用CSS定义虚线间隔
css是没办法设置虚线间距的
SVG线条是可以设置间距的
path {
stroke-dasharray: 4;
stroke-dashoffset: 22;
}2017-05-19
在正式绘制边框前,我们先认识一下CSS3 border-image-slice 属性,它可以将border-image-source获取的边框背景图片切割为9份。语法如下:
border-image:border-image-source slice-width{1,4}
slice-width的值可以是具体像素,也可以是百分比。切割后的图片块分别是
border-top-left-imageborder-top-imageborder-top-right-image
border-left-imageborder-right-image
border-bottom-left-imageborder-bottom-imageborder-bottom-right-image
其中,border-top-image和border-bottom-image区域受到水平方向效果影响,如果是repeat则此区域图片会水平重复,如果是round则会水平平铺,责任stretch则被水平拉升。而我们设置虚线,则选择repeat/round都可以。2017-05-19
CSS 的 border: 1px dashed 虚线的宽2017-05-19