Home > Web Front-end > HTML Tutorial > HTML5 SVG绘制圆形简单示例分享_html/css_WEB-ITnose

HTML5 SVG绘制圆形简单示例分享_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:26:05
Original
1418 people have browsed it

今天分享“svg绘制圆形”部分

1、简单圆形

效果图如下:

关键代码:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">     <circle cx="40" cy="40" r="40"></circle></svg>
Copy after login

代码解析:

cx和cy属性定义圆点的x和y坐标。如果省略cx和cy,圆的中心会被设置为(0, 0);

r属性定义圆的半径

2、圆形填充颜色及边框

效果图如下:

关键代码:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">     <circle cx="45" cy="45" r="40" stroke-width="3" stroke="blue" fill="red"></circle></svg>
Copy after login

 

代码解析:

fill 属性定义圆形的填充颜色(rgb 值、颜色名或者十六进制值);

stroke-width 属性定义圆形边框的宽度;

stroke 属性定义圆形边框的颜色

 

好了今天的分享这里结束,我也是一边学习一边分享的,若有错误的地方请大家指正,下次分享“svg绘制椭圆”部分,希望大家届时来浏览,谢谢大家。

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template