Easy Tutorial
❮ Css3 Pr Animation Name Css3 Pr Text Decoration Line ❯

CSS width Property

Example

Set the height and width of a paragraph:


Property Definition and Usage

The width property sets the width of an element.

Note: The width property does not include padding, border, or margin!

Default value: auto
Inherited: no
--- ---
Version: CSS1
--- ---
JavaScript syntax: object.style.width="50px"
--- ---

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
width 1.0 4.0 1.0 1.0 3.5

Property Values

Value Description
auto Default value. The browser calculates the actual width.
length Defines the width using units such as px, cm, etc.
% Defines the width as a percentage of the containing block (parent element).
inherit Specifies that the width should be inherited from the parent element.

More Examples

Set the width of an element using percentage


Related Articles

CSS Tutorial: CSS Dimension

CSS Tutorial: CSS Box model

CSS Reference: height property

❮ Css3 Pr Animation Name Css3 Pr Text Decoration Line ❯