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 = ...
随机推荐
- Sqoop的安装及简单使用
SQOOP是用于对数据进行导入导出的. (1)把MySQL.Oracle等数据库中的数据导入到HDFS.Hive.HBase中 (2)把HDFS.Hive.HBase中的数据导出到MySQL.Or ...
- 在windows下使用多版本Python安装相应的虚拟开发环境
在windows下面使用多版本Python安装相应的虚拟开发环境 在搭建一个项目的时候,希望使用最新版的Python3.7版本,但是Python3.6的版本也要留下,那么问题来了,如何解决这个问题 ...
- Python装饰器进阶
装饰器进阶 现在,我们已经明白了装饰器的原理.接下来,我们还有很多事情需要搞清楚.比如:装饰带参数的函数.多个装饰器同时装饰一个函数.带参数的装饰器和类装饰器. 装饰带参数函数 def foo(fun ...
- jQuery-Selectors(选择器)的使用(二、层次篇)(转载)
原文:http://www.cnblogs.com/bynet/archive/2009/12/01/1614405.html 本系列文章导航 jQuery-Selectors(选择器)的使用(一.基 ...
- 【记录】group_concat_max_len
这几天在帮别人定位一个问题,结果定位了半天都没有结果.redis中取出来的数据很奇怪,每次都不一样,而且总是取不完全. 我以为是redis的内存不够,导致数据丢失,但是不应该啊,这么点数据,也不至于内 ...
- 一个ScheduledExecutorService启动的Java线程无故挂掉引发的思考
2018年12月12日18:44:53 一个ScheduledExecutorService启动的Java线程无故挂掉引发的思考 案件现场 不久前,在开发改造公司一个端到端监控日志系统的时候,出现了一 ...
- sublime text3中文乱码问题解决方案
1. 首先需要安装包convertToUTF8,安装完重启后如果仍然不能正常显示中文,则需要进行用户配置. 2.用户配置:preferences>settings 在用户设置加入一个属性:&qu ...
- Linux驱动之串口(UART)
<uart驱动程序概述> 在嵌入式Linux系统中,串口被看成终端设备,终端设备(tty)的驱动程序分为3部分: tty_core tty_disicipline tty_driver ...
- KVM源代码解读:linux-3.17.4\include\linux\kvm_host.h
#ifndef __KVM_HOST_H #define __KVM_HOST_H /* * This work is licensed under the terms of the GNU GPL, ...
- jersey练习
package com.tz.router; import java.util.ArrayList; import java.util.Date; import java.util.List; imp ...