The width property sets the width of the element. It is seldom used with block-level elements. In fact, its use with such elements may lead to some complications. This property is most useful with replaced elements (such as IMG) and floating text elements.
This property has three types of values:
By default, width has the value auto. Usually, you won't set the width of a block-level element explicitly; you set only the margins, padding, and border. Exceptions are possibly the HTML element and tables or table columns. The actual width of the element is what is left after you subtract the margin, padding, and border from the available width, also called the inherited width. We detail how to work with the width property in the section, "The whole story on width computation." |