files/en-us/web/svg/reference/attribute/height/index.md
The height attribute defines the vertical length of an element in the user coordinate system.
You can use this attribute with the following SVG elements:
html,
body,
svg {
height: 100%;
}
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<!-- With a height of 0 or less, nothing will be rendered -->
<rect y="0" x="0" width="90" height="0" />
<rect y="0" x="100" width="90" height="60" />
<rect y="0" x="200" width="90" height="100%" />
</svg>
{{EmbedLiveSample("Example", '100%', 200)}}
For {{SVGElement('feBlend')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feColorMatrix')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feComponentTransfer')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feComposite')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feConvolveMatrix')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feDiffuseLighting')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feDisplacementMap')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feDropShadow')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feFlood')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feGaussianBlur')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feImage')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feMerge')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feMorphology')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feOffset')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feSpecularLighting')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feTile')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('feTurbulence')}}, height defines the vertical length for the rendering area of the primitive.
For {{SVGElement('filter')}}, height defines the vertical length for the rendering area of the filter.
For {{SVGElement('foreignObject')}}, height defines the vertical length for the rendering area for the referenced document.
[!NOTE] Starting with SVG2,
heightis a Geometry Property meaning this attribute can also be used as a CSS property for<foreignObject>.
For {{SVGElement('image')}}, height defines the vertical length for the image.
[!NOTE] Starting with SVG2,
heightis a Geometry Property meaning this attribute can also be used as a CSS property for images.
For {{SVGElement('mask')}}, height defines the vertical length of its area of effect. The exact effect of this attribute is influenced by the {{SVGAttr('maskUnits')}} attribute.
For {{SVGElement('pattern')}}, height defines the vertical length of the tile pattern. The exact effect of this attribute is influenced by the {{SVGAttr('patternUnits')}} and {{SVGAttr('patternTransform')}} attributes.
For {{SVGElement('rect')}}, height defines the vertical length for the rectangle.
[!NOTE] Starting with SVG2,
heightis a Geometry Property meaning this attribute can also be used as a CSS property for rectangles.
For {{SVGElement('svg')}}, height defines the vertical length for the rendering area of the SVG viewport.
<table class="properties"> <tbody> <tr> <th scope="row">Value</th> <td> <code>auto</code> | <strong ><a href="/en-US/docs/Web/SVG/Guides/Content_type#length"><length></a></strong > | <strong ><a href="/en-US/docs/Web/SVG/Guides/Content_type#percentage" ><percentage></a ></strong > </td> </tr> <tr> <th scope="row">Default value</th> <td><code>auto</code> (treated as <code>100%</code>)</td> </tr> <tr> <th scope="row">Animatable</th> <td>Yes</td> </tr> </tbody> </table>[!NOTE] In an HTML document if both the {{SVGAttr('viewBox')}} and
heightattributes are omitted, the svg element will be rendered with a height of150px
[!NOTE] Starting with SVG2,
heightis a Geometry Property meaning this attribute can also be used as a CSS property for<svg>.
For {{SVGElement('use')}}, height defines the vertical length for the referenced element.
[!NOTE]
heighthas no effect onuseelements, unless the element referenced has a viewBox - i.e., they only have an effect whenuserefers to asvgorsymbolelement.
[!NOTE] Starting with SVG2,
heightis a Geometry Property meaning this attribute can also be used as a CSS property for used elements.
{{Specifications}}