1. Home
  2. Computing & Technology
  3. Web Design / HTML

max-width

By Jennifer Kyrnin, About.com

max-width Description:

The max-width property defines largest width that an element should have.

max-width in CSS Versions:

max-width Syntax:

max-width: <length> | <percentage> | none | inherit

  • <length>
    The width is defined by a fixed measure.
  • <percentage>
    The width is defined by a percentage of the containing block's width.
  • none
    No limit on the width of the box.
  • inherit
    The element should have the same max-width setting as the parent.

max-width Initial Value:

none

max-width Applies To:

All elements but non-replaced inline elements, table rows, and row groups.

max-width Inheritance:

This property is not inherited.

max-width Browser Support:

max-width media type:

  • Visual

max-width Examples:

A paragraph with a max-width

<p style="max-width: 100px;">
This paragraph will not be more than 100 pixels wide.
</p>

max-width Special Notes:

  • Internet Explorer 6 does not support this property.
  • Make sure you define the overflow property if you want the contents to be clipped from an element that is larger than expected.
  • Also remember that setting limits on the size of elements can cause accessibility problems.

More max-width Information

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: max-width

©2008 About.com, a part of The New York Times Company.

All rights reserved.