Estilo maxHeight Propiedad
Ejemplo
Establezca la altura máxima de un elemento <div>:
document.getElementById("myDIV").style.maxHeight = "15px";
Definición y uso
La propiedad maxHeight establece o devuelve la altura máxima de un elemento.
La propiedad maxHeight solo tiene efecto en elementos a nivel de bloque o en elementos con posición absoluta o fija.
Nota: La altura de un elemento nunca puede ser mayor que el valor especificado por la propiedad maxHeight.
Sugerencia: para establecer o devolver la altura mínima de un elemento, use la propiedad minHeight .
Compatibilidad con navegador
Property | |||||
---|---|---|---|---|---|
maxHeight | Yes | Yes | Yes | Yes | Yes |
Sintaxis
Devuelve la propiedad maxHeight:
object.style.maxHeight
Establezca la propiedad maxHeight:
object.style.maxHeight = "none|length|%|initial|inherit"
Valores de propiedad
Value | Description |
---|---|
none | No limit on the height of the element. This is default |
length | Defines the maximum height in length units |
% | Defines the maximum height in % of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalles técnicos
Valor por defecto: | ninguna |
---|---|
Valor devuelto: | Una cadena, que representa la altura máxima de un elemento. |
Versión CSS | CSS2 |
Más ejemplos
Ejemplo
Devuelve la altura máxima de un elemento <div>:
alert(document.getElementById("myDIV").style.maxHeight);
páginas relacionadas
Tutorial CSS: Dimensión CSS
Referencia de CSS: propiedad de altura máxima
❮ Objeto de estilo