5.9. Images and Floating Elements

Most style rules apply to elements at fixed locations. Images and text items that “float” to the margins are in a special category, however.

width, height

auto | pt, pc, in, cm, mm | em, ex, px

These properties specify a fixed size for the element and are usually applied to images. Values can be in normal length units (see Table 5.1 in Section 5.11) or can be the keyword auto. For instance, a “bullet” type might be created as follows:

IMG.bullet { width: 50px; height: 50px }

The auto keyword applies to images where only one of width or height is specified as a length; it means that the image should be scaled, maintaining ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.