SVG提供了一个范围广泛的stroke属性。
分别有几下几种:
1.stroke
2.stroke-width
3.stroke-linecap
4.stroke-dasharray
使用分别如下所示:
stroke属性定义一条线,文本或元素轮廓颜色
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none"> <path stroke="red" d="M5 20 l215 0" /> <path stroke="blue" d="M5 40 l215 0" /> <path stroke="black" d="M5 60 l215 0" /> </g> </svg>
这个属性定义了一条线,文本或元素轮廓厚度
该属性定义不同类型的开放路径的终结(也就是路径的终结是什么形状的,按钮形或者矩形)
该属性用来创建虚线
代码如下所示:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <g fill="none" stroke="black" stroke-width="4"> <path stroke-dasharray="5,5" d="M5 20 l215 0" /> <path stroke-dasharray="10,10" d="M5 40 l215 0" /> <path stroke-dasharray="20,10,5,5,5,10" d="M5 60 l215 0" /> </g> </svg>