Positioning Layers

Using a stylesheet's ability to precisely position layers is a godsend—I rarely have to position anything using tables, which are wildly complicated and often unpredictable. You've already seen positioned layers in this book, so I won't belabor the point too heavily. Example 8-6 shows how our feature layer is positioned.

Example 8-6. Positioning the feature layer
#feature {
    position: absolute;
    left: 40;
    top: 180;
    width: 450
}

This code sets a layer called feature and states that the layer will be positioned according to the edges of the browser window—that's what “position: absolute” means. The layer is then moved 40 pixels from the left edge of the browser and 180 pixels down. We also set the width of the layer to 450 pixels ...

Get Advanced JavaScript™: Insights and Innovative Techniques 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.