Set the width of an element.

Value Description
size px - size in terms of pixels
em - size in terms of the current font size
in - size in terms of inches
cm - size in terms of centimeters
percentage The width of this element will be a percentage of the element it is inside of.
auto The browser will automatically choose the value.


p {
width: 200px;
border: 1px solid black;


This paragraph has a width of 200px. We have added a border so that you can see this width more easily. If you would like to make the width with percentages, that is fine too.

Compatibility Issues:

IE 5.0 - Width can be buggy at times.