You are here: Home > SVG Elements > rect element
Introduction
The rect element is used to create a rectangle.
Details
Usage
<rect x="50" y="50" width="200" height="100" fill="green" />
Attributes
Common attributes:
- x - the x-coordinate of the top-left corner of the rectangle. Defaults to 0.
- y - the y-coordinate of the top-left corner of the rectangle. Defaults to 0.
- width - the width of the rectangle. Must be non-negative. If 0, the rectangle will not render. Defaults to 0.
- height - the height of the rectangle. Must be non-negative. If 0, the rectangle will not render. Defaults to 0.
- fill - describes how the interior of the rectangle should be painted, see SVGFillProperties. The default value is "black".
- stroke - describes how the outline of the rectangle should be painted, see SVGStrokeProperties. The default value is "none".