/

HTML / CSS / JavaScript Tutorial

CSS Property: width

[this page | pdf | back links]

The CSS (CSS1) width property indicates the width of an element (excluding padding, borders and margins). It is overridden by the min-width or max-width properties, if either of them are present.

 

Valid property values (other than inherit and initial) are:

 

Value

Description

length

Width as a CSS length

%

Width of element defined as a percentage of width of its containing block

auto

(default value). Browser determines width

 

Default Value:

auto

JavaScript syntax:

e.g. object.style.width="300px"

Inherited:

No

Animatable:

Yes

 


NAVIGATION LINKS
Contents | Prev | Next | CSS Properties


Desktop view | Switch to Mobile