CSS:width
From MDC
[edit] Summary
The width property specifies the width of the content area of an element. The content area is inside the padding, border, and margin of the element.
- Initial value:
auto - Applies to: block level and replaced elements
- Inherited: no
- Percentages: refer to the width of the containing block
- Media:
visual - Computed value:
[edit] Syntax
width: <length> | <percentage> | auto | inherit | -moz-max-content | -moz-min-content | -moz-fit-content | -moz-available
[edit] Values
- length : can be in px, cm, in
- percentage : % specified as a percentage of containing block's width
- auto : the browser will calculate and select a width for the specified element
- -moz-max-content : the intrinsic preferred width New in Firefox 3
- -moz-min-content : the intrinsic minimum width New in Firefox 3
- -moz-available : the containing block width minus horizontal margin, border, and padding New in Firefox 3
- -moz-fit-content : the larger of:
- the intrinsic minimum width
- the smaller of the intrinsic preferred width and the available width New in Firefox 3
[edit] Examples
table{width: 100%;}
img{width: 200px;}
form{width: auto;}
[edit] Notes
The min-width and max-width properties override width.
[edit] Specifications
[edit] Browser compatibility
| Browser | Lowest Version |
|---|---|
| Internet Explorer | 4 |
| Netscape | 4 |
| Opera | 3.5 |