--- title: height slug: Web/CSS/height tags: - Propiedad CSS - Referencia translation_of: Web/CSS/height ---
La propiedad CSS height especifica la altura del area de contenido de un elemento. El área de contenido está dentro del padding, borde, y margen del elemento.
Las propiedades {{cssxref("min-height")}} y {{cssxref("max-height")}} sobreescriben el valor de {{Cssxref("height")}}.
{{cssinfo}}
/* Valores clave */ height: auto; /* Valores <length> */ height: 120px; height: 10em; /* Valores <percentage> */ height: 75%; /* Valores globales */ height: inherit; height: initial; height: unset;
<length><percentage>border-box {{experimental_inline}}content-box {{experimental_inline}}autofill-available para elementos inline o block, según sea más apropiado para el modo de escritura.max-content {{experimental_inline}}min-content {{experimental_inline}}available {{experimental_inline}}fit-content {{experimental_inline}}<div id="red">
<span>I'm 50 pixels tall.</span>
</div>
<div id="green">
<span>I'm 25 pixels tall.</span>
</div>
<div id="parent">
<div id="child">
<span>I'm half the height of my parent.</span>
</div>
</div>
div {
width: 250px;
margin-bottom: 5px;
border: 3px solid #999999;
}
#red {
height: 50px;
}
#green {
height: 25px;
}
#parent {
height: 100px;
}
#child {
height: 50%;
width: 75%;
}
{{EmbedLiveSample('Example')}}
| Especificación | Estado | Comentarios |
|---|---|---|
| {{SpecName('CSS3 Box', '#the-width-and-height-properties', 'height')}} | {{Spec2('CSS3 Box')}} | Añade las palabras clave max-content, min-content, available, fit-content, border-box, content-box. |
| {{SpecName('CSS3 Transitions', '#animatable-css', 'height')}} | {{Spec2('CSS3 Transitions')}} | Incluye height como propiedad que puede ser animada. |
| {{SpecName('CSS2.1', 'visudet.html#the-height-property', 'height')}} | {{Spec2('CSS2.1')}} | Añade soporte para valores {{cssxref("<length>")}} y especifica a qué elementos es aplicable. |
| {{SpecName('CSS1', '#height', 'height')}} | {{Spec2('CSS1')}} | Definición inicial |
| {{SpecName('CSS3 Sizing', '#width-height-keywords', 'width')}} | {{Spec2('CSS3 Sizing')}} | Añade nuevas palabras clave de tamaño para width y height |