Search within TutorialsPark

CSS width Property


To specify the width of the element.


Definition and Notes.

1. The CSS width property is used to define the width of an element's content area, outside of which padding, borders, and margins are added.

2.This property is ignored for inline nonreplaced element.Also, negative values are not allowed


Syntax:

CSS width property. internetexplorer safari firefox opera chrome

View in Splitscreen»

Code-Editor:

Note-The values of min-width and max-width can override the values of width.

Property Values

Value Description
auto Leaves it to the browser to define the width of the element
length To values of width are specified using length values.
% The values of width are specified in percentage values.
inherit To value for width is inherited from the parent element

Specifications

Specs Value
Name width
Value <length> <percentage> | auto | inherit
Initial Value auto
Applies to Block level and replaced elements
Javascript syntax object.style.width="100px"
Inherited No
Computed Value Refer to the width of the containing block
Browser Support internetexplorer safari firefox opera chrome


Related Examples.