--- title: rect slug: Web/SVG/Element/rect tags: - Elemento - Gráficos SVG - Referencia - Referência(2) - SVG translation_of: Web/SVG/Element/rect ---
O elemento <rect>
é uma forma SVG básica que desenha retângulos, definidos por sua posição, largura e altura. Os retângulos podem ter seus cantos arredondados.
html,body,svg { height:100% }
<svg viewBox="0 0 220 100" xmlns="http://www.w3.org/2000/svg"> <!-- Simple rectangle --> <rect width="100" height="100" /> <!-- Rounded corner rectangle --> <rect x="120" width="100" height="100" rx="15" /> </svg>
{{EmbedLiveSample('Example', 100, '100%')}}
0
; Animatable: yes0
; Animatable: yesauto
|<length>|<percentage> ; Default value: auto
; Animatable: yesauto
|<length>|<percentage> ; Default value: auto
; Animatable: yesry
if it is specified.auto
|<length>|<percentage> ; Default value: auto
; Animatable: yesrx
if it is specified.auto
|<length>|<percentage> ; Default value: auto
; Animatable: yesNote: Starting with SVG2, x
, y
, width
, height
, rx
and ry
are Geometry Properties, meaning those attributes can also be used as CSS properties for that element.
aria-activedescendant
, aria-atomic
, aria-autocomplete
, aria-busy
, aria-checked
, aria-colcount
, aria-colindex
, aria-colspan
, aria-controls
, aria-current
, aria-describedby
, aria-details
, aria-disabled
, aria-dropeffect
, aria-errormessage
, aria-expanded
, aria-flowto
, aria-grabbed
, aria-haspopup
, aria-hidden
, aria-invalid
, aria-keyshortcuts
, aria-label
, aria-labelledby
, aria-level
, aria-live
, aria-modal
, aria-multiline
, aria-multiselectable
, aria-orientation
, aria-owns
, aria-placeholder
, aria-posinset
, aria-pressed
, aria-readonly
, aria-relevant
, aria-required
, aria-roledescription
, aria-rowcount
, aria-rowindex
, aria-rowspan
, aria-selected
, aria-setsize
, aria-sort
, aria-valuemax
, aria-valuemin
, aria-valuenow
, aria-valuetext
, role
{{svginfo}}
Specification | Status | Comment |
---|---|---|
{{SpecName('SVG2', 'shapes.html#RectElement', '<rect>')}} | {{Spec2('SVG2')}} | |
{{SpecName('SVG1.1', 'shapes.html#RectElement', '<rect>')}} | {{Spec2('SVG1.1')}} | Initial definition |
{{Compat("svg.elements.rect")}}