CSS Property - Width

Value: <length> | <percentage> | auto
Initial: auto
Applies to: block-level and replaced elements
Inherited: no
Percentage values: refer to parent element's width

The CSS property "width" can be applied to text elements, but it is most useful with replaced elements such as images or divisions.

The width is to be enforced by scaling the image if necessary. When scaling, the aspect ratio of the image is preserved if the "height" property is "auto".

Example:

img.width {
width: 100px;
}

HTML:
<img class="width" src="images/image.gif" alt="" />

If the "width" and "height" of a replaced element are both "auto", these properties will be set to the intrinsic dimensions of the element.

Negative values are not allowed.

Check Out Our Sponsors
Check Out Our Host

ANHosting

Free CSS.com is proud to be hosted by ANHosting.com. US Based Support starting at only 23 cents a day.
Use the coupon code FREECSS for 3 free months of hosting. Click Here »

Bookmarks
RSS Feed    Search

For FREE HTML email templates that dont break - Sign up for a FREE account with MailChimp today!