<?xml version="1.0" encoding="utf-8"?>

SVG rectangle

SVG rectangle

To draw a rectangle on a screen, you need the <rect> element with 6 attributes to control the position and shape:

• The x defines the horizontal position of the top left corner of the rectangle

• The y defines the vertical position of the top left corner of the rectangle

• The width attribute sets the width of the rectangle

• The height attribute sets the height of the rectangle

• The rx and ry attributes define the horizontal and vertical radius of the rounded corners. If you omit them, they default to 0

Top contributors

Topics

From Lesson

Share

Improve your UX & Product skills with interactive courses that actually work