1.

How to draw a rectangle in SVG?

Answer»

'rect' tag of SVG is used to draw a rectangle. Following are the commonly used attributes −

  • x − x-axis co-ordinate of top left of the rectangle. Default is 0.

  • y − y-axis co-ordinate of top left of the rectangle. Default is 0.

  • width − width of the rectangle.

  • height − height of the rectangle.

  • rx − used to round the corner of the rounded rectangle.

  • ry − used to round the corner of the rounded rectangle.

Example −

<rect x = "100" y = "30" width = "300" height = "100" style = "fill:rgb(121,0,121);stroke-width:3;stroke:rgb(0,0,0)" >


Discussion

No Comment Found