NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix b » css1 / css2 properties

width


This property sets the width of an element's content region (excluding padding, border, and margin). Standard length units can be used and pixels (px) is often the assumed measurement in browsers. Percentage values, based on the width of the containing element, can also be used. The default value of auto automatically calculates the width of an element, based on the width of the containing element and the size of the content.

Examples


p {width: 400px; padding: 10px; border: solid 5px;}
#div1 {width: 80%; padding: 10px; border: solid 5px;}

Browser and CSS Support Notes


CSS1
IE 4, 5, 5.5, 6
Nav 4, 4.5-4.8, 6, 7
Opera 4, 5, 6, 7

(X)HTML Elements
CSS Properties
Back: widows Next: word-spacing
< Home | About | Chapters | Examples | Errata | Reference | Site Map >