rect

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

* Some parts of this feature may have varying levels of support.

El elemento rect es una forma básica de SVG, usada para crear rectángulos basada en la posición de una esquina, su alto y ancho. También podría ser usada para crear rectángulos con esquinas redondeadas.

Contexto de uso

CategoriasElemento de forma básica, Elemento gráfico, Elemento de forma
Contenido permitidoCualquier número de los siguientes elementos, en cualquier orden:
Elementos de animación
Elementos descriptivos

Ejemplo

Uso simple de rect

html
<?xml version="1.0"?>
<svg
  width="120"
  height="120"
  viewBox="0 0 120 120"
  xmlns="http://www.w3.org/2000/svg">
  <rect x="10" y="10" width="100" height="100" />
</svg>

must be provided

rect con esquinas redondeados

html
<?xml version="1.0"?>
<svg
  width="120"
  height="120"
  viewBox="0 0 120 120"
  xmlns="http://www.w3.org/2000/svg">
  <rect x="10" y="10" width="100" height="100" rx="15" ry="15" />
</svg>

must be provided

Atributos

Atributos globales

Atributos específicos

Interfaz DOM

Este elemento implementa la interfaz SVGRectElement.

Especificaciones

Specification
Scalable Vector Graphics (SVG) 2
# RectElement

Compatibilidad con navegadores

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
rect
fill
context-fill value
height
rx
ry
systemLanguage
width
x
y

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support

Ver también