|
|
Donner 0.5.1
Embeddable browser-grade SVG2 engine
|
Creates a rectangle with the top-left corner at (x, y) and the specified width and height, optionally with rounded corners.
The <rect> element draws an axis-aligned rectangle. You give it a top-left corner (x, y) and a width and height, and SVG fills the enclosed area with fill and outlines it with stroke. Set the optional rx and ry attributes to round the corners — useful for buttons, badges, and card backgrounds. To rotate or skew a rectangle, wrap it in a "<g>" with a transform attribute, or apply transform directly.
Use <rect> for backgrounds, panels, buttons, bars in a bar chart, or any other rectangular region. For arbitrary quadrilaterals, use "<polygon>" or "<path>".
| Attribute | Default | Description |
|---|---|---|
| x | 0 | Top-left corner X coordinate. |
| y | 0 | Top-left corner Y coordinate. |
| width | 0 | Width of the rectangle. |
| height | 0 | Height of the rectangle. |
| rx | auto ("auto" on rx/ry) | For rounded corners, the radius of the curve along the X axis. |
| ry | auto ("auto" on rx/ry) | For rounded corners, the radius of the curve along the Y axis. |