English 中文(简体)
SVG - Stroke
  • 时间:2024-11-03

SVG - Stroke


Previous Page Next Page  

SVG supports multiple stroke properties.

Following are the main stroke properties used.

Sr.No. Stroke Type & Description
1 stroke − defines color of text, pne or outpne of any element.
2 stroke-width − defines thickness of text, pne or outpne of any element.
3 stroke-pnecap − defines different types of ending of a pne or outpne of any path.
4 stroke-dasharray − used to create dashed pnes.

Example

testSVG.htm
<html>
   <title>SVG Stroke</title>
   <body>
   
      <h1>Sample SVG Stroke</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="30" >Using stroke: </text>
            <path stroke="red" d="M 50 50 L 300 50" />
            <path stroke="green" d="M 50 70 L 300 70" />
            <path stroke="blue" d="M 50 90 L 300 90" />
         </g> 
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.