--- title: max-width slug: Web/CSS/max-width tags: - CSS - CSS Referenz translation_of: Web/CSS/max-width ---
{{ CSSRef() }}
Die max-width Eigenschaft wird verwendet, um die maximale Breite eines Elements festzulegen. Das verhindert, dass der benutzte Wert der width Eigenschaft nicht größer wird als der festgelegte Wert von max-width.
Hinweis: max-width überschreibt width, allerdings überschreibt min-width auch max-width.
nonenonemax-width: <Längenangabe> | <Prozentzahl> | none | -moz-max-content | -moz-min-content | -moz-fit-content | -moz-available | inherit
-moz-max-content.body { max-width: 40em; }
table { max-width: 75%; }
form { max-width: none; }
Beispiel 1 {{ gecko_minversion_inline("1.9") }}
p { background: gold }
The Mozilla community produces a lot of great software.
Beispiel 2 {{ gecko_minversion_inline("1.9") }}
p { background: lightgreen;
max-width: intrinsic; /* Safari/WebKit */
max-width: -moz-max-content; /* Firefox/Gecko */
}
The Mozilla community produces a lot of great software.
Beispiel 3 {{ gecko_minversion_inline("1.9") }}
p { background: lightblue; max-width: -moz-min-content; }
The Mozilla community produces a lot of great software.
| Browser | ab Version | auf <table> anwendbar |
intrinsische Breite | minimale intrinsische Breite | ||
|---|---|---|---|---|---|---|
| Internet Explorer | 7.0 | nein | --- | --- | --- | --- |
| Firefox (Gecko) | 1.0 (1.0) | ja | 3.0 (1.9) | -moz-max-content |
3.0 (1.9) | -moz-min-content |
| Opera | 4.0 | ja | --- | --- | --- | --- |
| Safari (WebKit) | 2.0.2 (416), vorher fehlerhaft | nein | 2.0 (412) ? | intrinsic |
--- | --- |
{{ languages( { "en": "en/CSS/max-width", "es": "es/CSS/max-width", "fr": "fr/CSS/max-width" } ) }}