Setting the Height or Width for an Element

You can set the height and width for most elements, including images, form elements, and even blocks of text.

To set the height or width for an element:

  • Type width: w, where w is the width of the element’s content area, and can be expressed either as a length (with units) or as a percentage of the parent element. Or use auto to let the browser calculate the width.

  • Type height: h, where h is the height of the element, and can be expressed only as a length (with units). Or use auto to let the browser calculate the height.

Figure 11.11. Limiting the wrap div to 90% of the browser window gives it some air and helps it not look so cramped. By reducing the main div to 75% of the screen div (which is the same ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide 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.