SVG Stroke属性
一、stroke属性介绍
SVG提供了一个范围广泛stroke属性,用于描述轮廓,其中包括
- stroke 指定颜色
- stroke-width 指定宽度
- stroke-linecap 指定端点样式
- stroke-dasharray 指定间隔线数组
1.所有的stroke属性,可应用于任何类的线条、文字和元素就像一个圆的轮廓
2.所有的stroke属性,可以单独指定,可以都放在style属性中。
二、stroke属性定义一条线、文本或元素的轮廓颜色,stroke-width属性定义一条线、文本或元素轮廓厚度
<svg style="border:1px solid red;" width="400px" height="300px">
<g fill='none'>
<path stroke="red" stroke-width="5" d="M20 20,300 20 " />
<path stroke="blue" stroke-width="5" d="M20 120,300 120" />
<path stroke="black" stroke-width="5" d="M20 220,300 220"/>
</g>
</svg>
三、stroke-linecap属性定义不同类型的开放路径的终结
<svg style="border:1px solid red;" width="400px" height="300px">
<g fill='none' stroke-width="10">
<path stroke="red" stroke-linecap="round" d="M20 20,300 20 " />
<path stroke="blue" stroke-linecap="butt" d="M20 120,300 120" />
<path stroke="black" stroke-linecap="square" d="M20 220,300 220"/>
</g>
</svg>
四、stroke-dasharray属性用于创建虚线
<svg style="border:1px solid red;" width="500px" height="100px">
<g fill='none' stroke='black' stroke-width='4'>
<path stroke-dasharray='5,5' d='M5 20,400,20' />
<path stroke-dasharray='10,10' d='M5 40,400,40' />
<path stroke-dasharray='20,10,5,5,5,10' d='M5 60,400,60' />
</g>
</svg>
示例1,使用stroke描述文字轮廓
<svg style="border:1px solid red;" width="400px" height="400px">
<text x='100' y='100' fill='red' style='font-size:50px;font-weight:bold;font-family:楷体'
stroke='blue' stroke-width='2'
>中文内容</text>
</svg>
示例2,在style中使用stroke属性
<svg style="border:1px solid red;" width="200px" height="400px">
<rect style="stroke:blue;stroke-width:5px;stroke-dasharray:2 10 2"
width='100' height='100' x='50' y='50'></rect> <rect style="stroke:blue;stroke-width:3px;"
stroke-dasharray='2,10,2' fill='green'
width='100' height='100' x='50' y='200'></rect>
</svg>
SVG Stroke属性的更多相关文章
- 学习SVG系列(3):SVG Stroke属性
SVG stroke 属性 1.stroke 2.stroke-width 3.stroke-linecap 4.stroke-dasharray 5.stroke-opacity 6.stroke- ...
- SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组
目录 SVG 学习<一>基础图形及线段 SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组 SVG 学习<三>渐变 SVG 学习<四 ...
- svg & stroke & style & class
svg & stroke & style & class svg selected style methods style class, !important fill, st ...
- SVG(可扩展矢量图)系列教程
本系列教程同步至博客www.waylau.com 从新往久排序,持续更新 SVG与JS交互实例之画板 SVG <marker>创建箭头 SVG实例之中国地图 SVG实例之电力开关 SVG ...
- 学习SVG 重点汇总
什么是SVG? Δ SVG 指可伸缩矢量图形 (Scalable Vector Graphics) Δ SVG 用来定义用于网络的基于矢量的图形 Δ SVG使用XML格式来定义图形 Δ SVG ...
- SVG 使用marker画箭头(一)
一.使用Marker画箭头 1.定义一个箭头的marker引用 <defs> <marker id='markerArrow' markerWidth='13' markerHeig ...
- SVG Path路径使用(一)
一.<path> 标签 <path> 标签用来定义路径. 下面的命令可用于路径数据: M = moveto L = lineto H = horizontal lineto V ...
- Svg.Js 父类的基础操作
一.SVG.Doc 创建SVG文档 var draw = SVG('drawing') <div id="svg1"></div> <script&g ...
- Svg.Js A标签,链接操作
一.创建a标签,为a标签添加内容 <div id="svg1"></div> <script> //SVG.A 链接创建 var draw = ...
随机推荐
- JAVA 传递
其实java里面都是传值,只不过基本数据类型传的是数值,而引用类型传的是对象的地址. 作者:Intopass链接:https://www.zhihu.com/question/31203609/ans ...
- [POI2013]Usuwanka
[POI2013]Usuwanka 题目大意: 一排\(n\)个球,有黑白两种颜色.每取走一个球会在原位置放一个水晶球.求构造一种取球方案,满足: 每次取走\(k\)个白球和\(1\)个黑球: 一次取 ...
- hdu 4169 二分匹配最大独立集 ***
题意:有水平N张牌,竖直M张牌,同一方向的牌不会相交.水平的和垂直的可能会相交,求最少踢出去几张牌使剩下的牌都不相交. 二分匹配 最小点覆盖=最大匹配. 链接:点我 坐标点作为匹配的端点 #inclu ...
- Codeforces Round #370 (Div. 2) C. Memory and De-Evolution 水题
C. Memory and De-Evolution 题目连接: http://codeforces.com/contest/712/problem/C Description Memory is n ...
- CocoaPods第三方库管理工具
http://code4app.com/article/cocoapods-install-usage
- Spring @Value的$和#用法区别
@Value的值有两类: ① ${ property : default_value } ② #{ obj.property? : default_value } 就是说,第一个注入的是外部参数对应的 ...
- USBDM RS08/HCS08/HCS12/Coldfire V1,2,3,4/DSC/Kinetis Debugger and Programmer -- MC9S08JM16/32/60
Introduction The attached files provide a port of a combined TBDML/OSBDM/TBLCF code to a MC9S08JM16/ ...
- 谨慎注意WebBrowser控件的DocumentCompleted事件
引言 WebBrowser控件的DocumentCompleted事件一般就被认定为是在页面完全加载完毕后产生,而注释中也是这么写的: 但事实却并非如此. 首先它不一定会在完全加载完毕时才触发,有时就 ...
- 在ASP.NET MVC中使用Boostrap实现产品的展示、查询、排序、分页
在产品展示中,通常涉及产品的展示方式.查询.排序.分页,本篇就在ASP.NET MVC下,使用Boostrap来实现. 源码放在了GitHub: https://github.com/darrenji ...
- Android Service总结01 目录
Android Service总结01 目录 1 Android Service总结01 目录 2 Android Service总结02 service介绍 介绍了“4种service 以及 它们的 ...