PDA

View Full Version : Help with divs


wolfmanbc
12-09-2008, 10:35 PM
Whats the easiest way to play a div directly under a div, so i can have divs stacked on top of each other with no room in between?

Ricky55
12-09-2008, 10:41 PM
They will naturally do this, following what's known as normal flow.

See code example


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">

#boxOne {
width: 200px;
height: 200px;
background: red;
}

#boxTwo {
width: 200px;
height: 200px;
background: teal;
}


</style>

</head>

<body>
<div id="boxOne"></div>
<div id="boxTwo"></div>
</body>
</html>

Ricky55
12-09-2008, 10:42 PM
The harder part is making them do any thing other than this!

wolfmanbc
12-10-2008, 03:24 AM
ha, thanks man

coloeagle
12-10-2008, 03:53 AM
The harder part is making them do any thing other than this!:lol:
Yup, float left, float right, absolutely positioned here and there, clear this and that, layered up or down. Oh the fun begins when you start taking away from the natural. 8-)