<div> and </div>

PURPOSE: To divide a section of the page for text or images. Usually used with CSS commands for absolute positioning of a block of text or image.

Below is a basic html document. The referenced html tag is in RED. All tags must have a start and a end tag. Most end tags have a / before the tags name, however there are a few that are done differently. The tags that end differently will be noted and highlighted. The order of the start and end tags is also very important to proper display of your page in a web browser.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> The Page Title Goes Here </title>
</head>
<body>
<DIV id="image1" style="position:absolute; top:200px; left:200px; z- index:2;"><IMG src="something.jpg" height="00" width="00" alt="image one"></DIV>
</body>
</html>

The "id" attribute for the DIV tag, names the DIV and everything in it. The position:absolute positions the top and left corner of the image 200 pixels from the top of the browser window and 200 pixels from the left side of the browser window. The z-index property sets the stack order of the image. The greater z-index is always in front of another element with lower z-index. This is how you can overlay one image or text over another image or text. You can learn more on z-index in the CSS tutorial.


© Copyright 2001,2002 Southern Twilight    All rights reserved.

Back To HTML Examples