课程表

SVG 教程

SVG 实例/手册

工具箱
速查手册

SVG Stroke 属性

当前位置:免费教程 » 软件/图像 » SVG

SVG Stroke 属性

SVG提供了一个范围广泛stroke 属性。在本章中,我们将看看下面:

所有stroke属性,可应用于任何种类的线条,文字和元素就像一个圆的轮廓。


SVG stroke 属性

Stroke属性定义一条线,文本或元素轮廓颜色:

下面是SVG代码:

实例

<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>

尝试一下 »

对于Opera用户:查看SVG文件(右键单击SVG图形预览源)。


SVG stroke-width 属性

Tstroke- width属性定义了一条线,文本或元素轮廓厚度:

下面是SVG代码:

实例

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <g fill="none" stroke="black">
    <path stroke-width="2" d="M5 20 l215 0" />
    <path stroke-width="4" d="M5 40 l215 0" />
    <path stroke-width="6" d="M5 60 l215 0" />
  </g>
</svg>

尝试一下 »

对于Opera用户:查看SVG文件(右键单击SVG图形预览源)。


SVG stroke-linecap 属性

strokelinecap属性定义不同类型的开放路径的终结:

下面是SVG代码:

实例

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <g fill="none" stroke="black" stroke-width="6">
    <path stroke-linecap="butt" d="M5 20 l215 0" />
    <path stroke-linecap="round" d="M5 40 l215 0" />
    <path stroke-linecap="square" d="M5 60 l215 0" />
  </g>
</svg>

尝试一下 »

对于Opera用户:查看SVG文件(右键单击SVG图形预览源)。


SVG stroke-dasharray 属性

strokedasharray属性用于创建虚线:

下面是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>

尝试一下 »

对于Opera用户:查看SVG文件(右键单击SVG图形预览源)。

转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号