Friday, March 13, 2015

Drawing a rectangle in SVG

SVG has many predefined shape elements which can be used by the developers and designers , one of them is <rect> . <rect> element of the SVG is used to create  rectangle. It can also be used for the creation of variations of rectangle shapes. 
Example:

 <!DOCTYPE html>  
 <html>  
 <head lang="en">  
 <meta charset="UTF-8"/>  
 <title>SVG Example</title>  
 <style>  
 rect{  
 fill:green;  
       stroke-width:4;  
 stroke:red;  
     }  
 </style>  
 </head>  
 <body>  
 <h2>SVG Rectangle </h2>  
 <svg width="700" height="600">  
 <rect width="250" height="90"/>  
 <rect x="80" y="110" width="250" height="150"/>  
 <rect x="180" y="270" rx="40" ry="50" width="250" height="150" />  
 </svg>  
 </body>  
 </html> 

No comments:

Post a Comment