Chapter 9. Relative and Absolute Positioning

The normal way a document is laid out is that the boxes for all elements are put one after the other or below the other (depending on whether they are inline or block), with their distances and alignments specified by properties such as margin, padding, and width. An occasional box is shifted to one side with the float property. In this way, the boxes fill the canvas, or the pages, starting from the top and continuing until all boxes are placed.

Relative positioning adds to this the ability to make corrections to the positions of individual boxes without affecting other boxes. For example, a box may be moved up or down to overlap another box. It is seldom needed in a style sheet. The place where the ...

Get Cascading Style Sheets: Designing for the Web, Third 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.