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

width

By Jennifer Kyrnin, About.com

width Description:

The width property defines the width of the element.

width in CSS Versions:

width Syntax:

width: <length> | <percentage> | auto | inherit

  • length
    A specific length (include unit of measure).
  • percentage
    A percentage of the width of the parent element.
  • auto
    Allows the user-agent to define the width based on inheritance and pre-set user-agent rules.
  • inherit
    The element should have the same width setting as the parent.

width Initial Value:

auto

width Applies To:

All block-level and replaced elements.

width Inheritance:

This property is not inherited.

width Browser Support:

width Examples:

Standard width property

<p style="width : 500px;">
This paragraph is 500px wide.
</p>

width Special Notes:

  • Negative values are not allowed.
  • When used for replaced elements, the width will be enforced by scaling the element.

More 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: width

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

All rights reserved.