首页 > 代码库 > [javascript svg fill stroke stroke-width x1 y1 x2 y2 line stroke-opacity fill-opacity 属性讲解] svg fill stroke stroke-width stroke-opacity fill-opacity line绘制线条属性讲解

[javascript svg fill stroke stroke-width x1 y1 x2 y2 line stroke-opacity fill-opacity 属性讲解] svg fill stroke stroke-width stroke-opacity fill-opacity line绘制线条属性讲解

 1 <!DOCTYPE html> 2 <html lang=‘zh-cn‘> 3 <head> 4 <title>Insert you title</title> 5 <meta name=‘description‘ content=‘this is my page‘> 6 <meta name=‘keywords‘ content=‘keyword1,keyword2,keyword3‘> 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 8 <link rel=‘stylesheet‘ type=‘text/css‘ href=http://www.mamicode.com/‘./css/index.css‘ />"color: #008080;"> 9 <script type=‘text/javascript‘ src=http://www.mamicode.com/‘./js/jquery-1.12.1.min.js‘></script>"color: #008080;">10 <style type=‘text/css‘>11 html,body,div,svg {12     margin: 0; padding: 0;13 }14 15 #wrap {16     width: 500px; height: 450px; border: 1px solid #999; border-radius: 2px; margin: 25px auto;17 }18 19 svg {20     height: 100%; width: 100%;21     /* 在谷歌浏览器中如果不指定svg的大小,那么使用默认的300*150大小(将焦点放置在调控台{Element}中的标签上可以检查),但是在火狐中表现却不同22     即使我们不指定svg的大小,指定父元素的大小,那么svg的大小将继承父元素;23      */24 }25 </style>26 <script type=‘text/javascript‘>27     $( function(){28 29     } );30 </script>31 </head>32 <body>33     <div id=‘wrap‘>34         <svg xmlns=‘http://www.w3.org/2000/svg‘ version=‘1.1‘>35          <line x1=‘195‘ y1=‘150‘ x2=‘350‘ y2=‘310‘ fill=‘ #09F3C7 ‘ stroke=‘#C7F309‘36                 stroke-width=‘3‘ stroke-opacity = ‘.3‘ fill-opacity = ‘.9‘37             ></line>   <!-- 参数解析 x1 y1 x2 y2 起止点坐标  如果想设置为透明(none/transparent)虽然none与transparent效果相同但是机理完全不同none是没有填充 transparent38                                 是透明, 勾勒描边为无 style = "fill:#09F3C7 ;stroke:#C7F309;" stroke-opacity = ‘.3‘ fill-opacity = ‘.9‘-->39         </svg>40     </div>41 </body>42 </html>

 

[javascript svg fill stroke stroke-width x1 y1 x2 y2 line stroke-opacity fill-opacity 属性讲解] svg fill stroke stroke-width stroke-opacity fill-opacity line绘制线条属性讲解