I am facing an issue with three floats in my layout. Two sections are exactly the same, but one of them loses its shape unless text is added to it.
Here is my HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>test</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="css.css" type="text/css" />
</head>
<body>
<div id="pagewidth" >
<div id="header"><h2>Head</h2></div>
<div id="twocols">
<div id="maincol"><h1>Main Content Column</h1><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p> <p>Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus.</p> </div>
<div id="rightcol"><p>a</p></div>
</div>
<div id="leftcol"></div>
</div>
</body>
</html>
The issue lies in my CSS as rightcol won't show properly.
html, body{
margin:0;
padding:0;
text-align:center;
}
#pagewidth{
width:100%;
hight:100%;
text-align:left;
margin:0 auto;
}
#header{
position:relative;
height:3%;
background-color:#000000;
width:100%;
display:block;
overflow:auto;
}
#leftcol{
width:5%;
height:97%;
float:left;
position:absolute;
background-color:#000000;
}
#twocols{
width:90%;
height:97%;
float:right;
position:relative;
}
#rightcol{
width:5%;
float:right;
position:relative;
background-color:#000000;
}
#maincol{
background-color: #FFFFFF;
float: left;
position: relative;
width:94%;
}