Positioning Divisions

There are two ways of positioning a division: you can use the float style rule, as you did with pictures in Part II, or you can use the position style rule. The following sections explain each of these methods.

Floating a Division to the Right or Left

The easiest way to place one division beside another is to use the float style rule. For example, to make a navigation bar that floats to the left of the main body text, you can set the navigation bar’s division to a certain width (perhaps 150 pixels or so), and then float it like this:

<div id="topnav" style="width: 150px; float: left">
Floating a Division to the Right or Left

The main advantage of using divisions is consistency ...

Get HTML and XHTML Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.