MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

Esta tradução está incompleta. Por favor, ajude a traduzir este artigo.

« SVG Attribute reference home

Esse atributo indica  um compromimento horizontal no sistema de coordenadas do usuário. O efeito exato dessa coordenada, depende de cada elemento. Na maioria das vezes, representa a largura da região retangular do elemento de referência.

Esse atributo precisa ser especificado, exceto para o elemento <svg> onde o valor padrão é 100% (com exceção do elemento root <svg> que contém pais HTML). e o <filter> e <mask>, elementos que o valor padrão é 120%.

Contexto de Uso

Categories None
Value <length>
Animatable Yes
Normative document SVG 1.1 (2nd Edition): foreignObject element
SVG 1.1 (2nd Edition): image element
SVG 1.1 (2nd Edition): pattern element
SVG 1.1 (2nd Edition): rect element
SVG 1.1 (2nd Edition): svg element
SVG 1.1 (2nd Edition): use element
SVG 1.1 (2nd Edition): Filter primitive
SVG 1.1 (2nd Edition): mask element

<length>

A length is a distance measurement, given as a number along with a unit. Lengths are specified in one of two ways. When used in a stylesheet, a <length> is defined as follows:

length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" | ~"pt" | ~"pc")?

See the CSS2 specification for the meanings of the unit identifiers.

For properties defined in CSS2, a length unit identifier must be provided. For length values in SVG-specific properties and their corresponding presentation attributes, the length unit identifier is optional. If not provided, the length value represents a distance in the current user coordinate system. In presentation attributes for all properties, whether defined in SVG1.1 or in CSS2, the length identifier, if specified, must be in lower case.

When lengths are used in an SVG attribute, a <length> is instead defined as follows:

length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?

The unit identifiers in such <length> values must be in lower case.

Note that the non-property <length> definition also allows a percentage unit identifier. The meaning of a percentage length value depends on the attribute for which the percentage length value has been specified. Two common cases are:

  • when a percentage length value represents a percentage of the viewport width or height
  • when a percentage length value represents a percentage of the bounding box width or height on a given object.

In the SVG DOM, <length> values are represented using SVGLength or SVGAnimatedLength objects.

Exemplo

<?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>

Elementos

Os seguintes elementos podem user o atributo witdh

Etiquetas do documento e colaboradores

 Colaboradores desta página: webmasterdro
 Última atualização por: webmasterdro,