Name

max-width, min-width — NN n/a IE n/a CSS 2

Synopsis

Inherited: No

These attributes let you establish a minimum and/or maximum width for an element. You can bracket the permissible width of an element regardless of the width caused by the natural flow of the content within a parent container.

CSS Syntax

max-width: length | percentage 
min-width: length | percentage

Value

See the discussion of length values at the beginning of the chapter. The value may also be a percentage that is calculated relative to the element’s container.

Initial Value

0 (min-width); 100% (max-width).

Applies To

All elements.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.