Laying out pages and positioning elements can be achieved by using CSS and the <div> (divisional) tag. This page covers practical methods for creating page layout with <div> tags and nested <div> tags (<div> tags within <div> tags). You will need to understand the following concepts ...
Nested <div> tags
A <div id> tag can be placed within the flow of an (X)HTML document and content such as text, images and other linked media positioned within it. For example ...
<p>This is some text in the first column</p>
A new style (advanced selector) is then created in a Cascading Style Sheet which can determine property/values such as ...
Here is an example style ...
You can make a class selector work like a <div id> tag. Here's an example with an attached style ...
<p>Here is some content in a box</p>
This works well when you want to create multiple boxout elements on a page within the html flow. Obviously you will not be able to give them individual positioning property/values so they will not function well as layers.
By putting one div tag inside another (nesting) you can control the layout and positioning of multiple elements such as columns and boxes. For example ...
<div id="header">Content goes here</div>
<div id="column1">Content goes here</div>
<div id="column2">Content goes here</div>
<div id="footer">Content goes here</div>
In this example, "containerbox" could be defined as a box the size of the site (760 x 490px for example) and "column1" could be a box that hugs the left hand edge of it.
Have a look at the Column and Boxout examples on our CSS examples page .
When you add Positioning and stacking order (Z-index) to a <div> tag it becomes a layer. Click here for more on Layers.