学习SVG系列(3):SVG Stroke属性
SVG stroke 属性
1、stroke
2、stroke-width
3、stroke-linecap
4、stroke-dasharray
5、stroke-opacity
6、stroke-linejoin
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>
stroke-width属性
stroke-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>
Stroke-linecap属性
Stroke-linecap属性定义线段端点的风格,这个属性可以使用butt/square/round三个值

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>
stroke-dasharray属性
该属性用于创建虚线:

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>
stroke-opacity属性
该属性设置边框的透明度,值的范围从0到1

SVG代码:
<svg
width="160" height="280"
xmlns="http://www.w3.org/2000/svg">
<polyline points="40 60 80 20 120 60"
stroke="black" stroke-opacity="1"
stroke-width="10"
fill="transparent" stroke-linejoin="miter" />
<polyline points="40 100 80 60 120 100"
stroke="black" stroke-opacity="0.5"
stroke-width="10" fill="transparent"
stroke-linejoin="round" />
<polyline points="40 140 80 100 120 140"
stroke="black" stroke-opacity="0.1"
stroke-width="10" fill="transparent" stroke-linejoin="bevel"
/>
</svg>
stroke-join属性
该属性设置线条拐弯处的连接方式

SVG代码:
<svg
width="160" height="280"
xmlns="http://www.w3.org/2000/svg">
<polyline points="40 60 80 20 120 60"
stroke="black"
stroke-width="10"
fill="transparent" stroke-linejoin="miter" />
<polyline points="40 100 80 60 120 100" stroke="black" stroke-width="10"
fill="transparent" stroke-linejoin="round" />
<polyline points="40 140 80 100 120 140"
stroke="black"
stroke-width="10" fill="transparent"
stroke-linejoin="bevel" />
</svg>
学习SVG系列(3):SVG Stroke属性的更多相关文章
- SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组
目录 SVG 学习<一>基础图形及线段 SVG 学习<二>进阶 SVG世界,视野,视窗 stroke属性 svg分组 SVG 学习<三>渐变 SVG 学习<四 ...
- 学习SVG系列(4):SVG滤镜效果
注意:Internet Explorer和Safari不支持SVG滤镜 <defs>.<filter> 所有互联网的SVG滤镜定义在<defs>元素中,<fi ...
- 学习SVG系列(1):SVG基础
什么是SVG? 1.指可伸缩矢量图形 2.用来定义用于网络的基于矢量的图形 3.使用XML格式定义图形 4.图像在放大或改变尺寸的情况下其图形不会有所损失 5.万维网联盟的标准, 用于描述二维矢量图形 ...
- 3. svg学习笔记-基本形状和画笔属性
svg中可以绘制的基本图形有线段,矩形,多边形,圆,椭圆,分别来看一下这些基本图形: 线段 使用<line>元素创建一条线段,格式如下: <line x1=" start- ...
- SVG Stroke属性
一.stroke属性介绍 SVG提供了一个范围广泛stroke属性,用于描述轮廓,其中包括 stroke 指定颜色 stroke-width 指定宽度 stroke-linecap 指定端点样式 st ...
- 学习SVG系列(5):SVG渐变
SVG渐变 渐变是一种从一种颜色到另一种颜色的平滑过渡,可以把多个颜色的过渡应用到同一个元素. 渐变有两种: Linear Redial 线性渐变-<linearGradient> lin ...
- SVG系列教程:SVG简介与嵌入HTML页面的方式
地址:http://www.w3cplus.com/html5/svg-introduction-and-embedded-html-page.html 随着技术向前的推进,SVG相关的讨论也越渐频繁 ...
- HTML5 学习03——内联 SVG
什么是SVG? SVG 指可伸缩矢量图形 (Scalable Vector Graphics) SVG 用于定义用于网络的基于矢量的图形 SVG 使用 XML 格式定义图形 SVG 图像在放大或改变尺 ...
- MongoDB学习笔记系列
回到占占推荐博客索引 该来的总会来的,Ef,Redis,MVC甚至Sqlserver都有了自己的系列,MongoDB没有理由不去整理一下,这个系列都是平时在项目开发时总结出来的,希望可以为各位一些帮助 ...
随机推荐
- volatile关键字及编译器指令乱序总结
本文简单介绍volatile关键字的使用,进而引出编译期间内存乱序的问题,并介绍了有效防止编译器内存乱序所带来的问题的解决方法,文中简单提了下CPU指令乱序的现象,但并没有深入讨论. 以下是我搭建的博 ...
- 数组中的toString,toLocalString,valueOf方法有什么区别
1. 2.简单来说,tostring就是用字符串来代替对象.tolocalstring就是根据不同的语言环境吧对象转成字符串,实际上totolocalstring是有缺省参数的,如tolocalstr ...
- Java—事件和多线程机制
一 事件 1.1 事件源 图形用户界面上每个可能产生事件的组件称为事件源. 1.2 事件监听者 Java系统中注册的用于接收特殊事件的类.不同的事件对应着不同的监听者,要想事件被监听者监听并处理,则 ...
- Java—数据库技术
JDBC(Java Database Connection,Java数据库连接)是一种用于执行SQL语句的JavaAPI(应用程序设计接口),它由一些Java语言写的类和界面组成.JDBC提供了一种标 ...
- Python笔记总结week8
面向对象第二节 要点: 1. 封装,对象中嵌套对象 2. pickle,load,切记,一定要先导入相关的类 回顾上一节: 面向对象三大特性: 封装.继承.多态(多种类型.多种形态) 关于多态,任意参 ...
- Mac +WebStorm+nodeJs+Freemarker.js的安装与使用
第一步用webStorm新建node+express项目 第二步执行npm i –save freemarker.js,安装 freemarker.js 模块 第三步安装java jdk包 jdk包地 ...
- java selenium (六) XPath 定位
xpath 的定位方法, 非常强大. 使用这种方法几乎可以定位到页面上的任意元素. 阅读目录 什么是xpath xpath 是XML Path的简称, 由于HTML文档本身就是一个标准的XML页面, ...
- 性能adb命令
启动时间-冷启动启动App命令adb shell am start -W -n com.bit_health.android/.ui.common.activities.BitHealthMainAc ...
- Linux 关机命令
正确的关机流程是:sync –> shutdown/reboot/halt/poweroff sync 将数据由内存同步到硬盘中. shutdown 关机指令.例如你可以运行如下命令关机: sh ...
- 15个实用的jQuery代码片
(function($) { var cache = []; // Arguments are image paths relative to the current page. $.preLoadI ...