max-height

Baseline Widely available *

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

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

Resumen

La propiedad max-height se utiliza para definir la altura máxima de un elemento dado. Impide que el valor de la altura pueda llegar a ser más grande que la de max-height.

Sintaxis

max-height: <length> | <percentage>

Valores

  • none : la altura no tiene valor máxima.
  • length : puede ser en px, cm, in (píxel, centímetro o inches)
  • percentage : % especificado como un porcentaje de la altura del bloque contenedor.

Ejemplos

table { max-height: 75%; }

form { max-height: none; }

Notas

max-height sobrescribe height, pero no min-height.

Especificaciones

Specification
CSS Box Sizing Module Level 4
# width-height-keywords
CSS Box Sizing Module Level 4
# sizing-values

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
max-height
anchor-size()
Experimental
fit-content
fit-content()
Experimental
max-content
min-content
none
stretch
Experimental

Legend

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

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.
User must explicitly enable this feature.
Uses a non-standard name.
Requires a vendor prefix or different name for use.
Has more compatibility info.

Ver también