The <DIV> Tag

We looked at this briefly earlier in the chapter, but it's now time to consider it in more detail. We use

<DIV>…</DIV>
blocks to create what we'll call a document division. We can think of a division as a separate part of the HTML page – in effect an HTML page in itself, inside a top level page and displayed in the same browser window.

We can have any number of divisions in a page, and each division has its own set of style properties that can be used to position the division anywhere on the page, down to the pixel. Divisions have a z-index property and can overlap each other. Text or other elements inside a division automatically take the font, color, and other settings from their parent division, allowing us to set the formatting properties of objects (like small blocks of text) that might not have their very own set of style properties.

Finally, when using

<DIV>
with absolute position, it's important to remember that the
<DIV>
tag starts a new coordinate system that is relative only to the HTML placed within the
<DIV>
</DIV>
block.

The

<DIV>
tag is one of the most useful single tags in Dynamic HTML programming and you'll get very familiar with it as you read and use the rest of this book.

© 1997 by Wrox Press. All rights reserved.