Chapter 16. Centering Fixed-Width CSS Layouts

One good technique for centering a fixed-with CSS layout is to use nested layers, a.k.a. nested divs. A nested layer is a div element inside another div, just as nested tables are tables within tables. In this scenario, the main div is a container. This is the div that you actually center. The nested layers inside provide the site content. Figure 16.1 shows a typical CSS layout with nested layers.

Figure 16.1. To build a centered CSS layout, use a container div to hold nested content divs, and then center the container.

GEEKSPEAK

A nested layer or nested div is a div element that appears inside another ...

Get Web Design Garage 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.