Forum Moderators: not2easy
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>This is a test page</title>
<link rel = "stylesheet" type = "text/css" href = "style.css">
</head>
<body>
<div id = "wrapper">
<div id = "A">
<p>A</p>
</div>
<div id = "B">
<p>B</p>
</div>
<div id = "C">
<p>C</p>
</div>
<div id = "D">
<p>D</p>
</div>
</div><!-- END of wrapper-->
</body>
</html>
#wrapper
{
border: 1px solid black;
width:100%;
height:900px;
margin: 0 auto;
}
#A
{
border: none;
background-color:pink;
width:50%;
height:450px;
float:left;
text-align:center;
}
#B
{
border: none;
background-color:green;
width:50%;
height:225px;
float:left;
text-align:center;
}
#C
{
border: none;
background-color:blue;
width:50%;
height:225px;
float:left;
text-align:center;
}
#D
{
clear:both;
border: none;
background-color:yellow;
width:100%;
height:450px;
text-align:center;
}
p
{
margin-top: 100px;
}
#A p
{
margin-top: 200px;
}
#D p
{
margin-top:200px;
}
#D p
{
margin-top:200px;
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>This is a test page</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
#wrapper {
border:1px solid #000;
height:900px;
text-align:center;
}
#a,#d {
float:left;
width:50%;
height:250px;
padding-top:200px;
background-color:#ffc0cb;
}
#b,#c {
float:left;
width:50%;
height:125px;
padding-top:100px;
background-color:#008000;
}
#c {
background-color:#00f;
}
#d {
clear:both;
width:100%;
background-color:#ff0;
}
p {
margin:0;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="a"><p>A</p></div>
<div id="b"><p>B</p></div>
<div id="c"><p>C</p></div>
<div id="d"><p>D</p></div>
</div><!-- end of wrapper-->
</body>
</html>
line-height:xxpx; where xxpx is the pixel value of the div's height? So in other words if I leave my code as it was and give each div a line-height depending on the height? That works fine. Is your code (with the padding) a better solution than using line-height? If yes, why?
No problem, you're very welcome. ;)