CSS Grids: Customize the Page Width

We've made it easy to customize the page width. pixels/13 = ems for all non-IE browsers. For IE, pixels/13.3333 = ems. (I find it useful to preserve up to four decimal places (1.2345) before rounding.)

This example shows three stacked divs, each with their own custom width applied. The first region is 400px wide, second is 500px, and the final region is 600px wide.

Customizing the Page Width

We've made it easy to customize the page width. pixels/13 = ems for all non-IE browsers. For IE, pixels/13.3333 = ems. (I find it useful to preserve up to four decimal places (1.2345) before rounding.)

Notes on Customizing Page Widths

Here are some other things to keep in mind.

  1. The width is set in ems because ems scale with user-initiated font-size adjustment.
  2. YUI Fonts does a good job of normalizing the width of an em, but we're still obliged to provide a slightly different value for IE.
  3. Be sure the width value for IE comes after the value for everybody else.
  4. Setting the min-width is optional, but helps the grid maintain integrity as the viewport shrinks.
  5. The text-align and margin are used to help center the page, and should not generally be modified.

Copyright © 2009 Yahoo! Inc. All rights reserved. Copyright | Privacy Policy | Terms of Use | Job Openings