F
Floortje
Hi, I have cerated a page with a 2 colum layout by floating the left
column top the left and adding a left margin to the main div.
The only problem is when I float divs in the main div I cant use
clear:left anymore since it does not only clear the floating divs in the
main div bu also the floating div outside the main div.
Does anymone know a workaround that lets me keep the left div floating ?
Here is the html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
#page{width:800px;margin 0 auto;}
#header{background-color:#1D1;height:50px;}
#left{background-color:#C2C;float:left;width:200px;}
#main{background-color:#EFE;margin-left:220px}
#footer{background-color:#ABA;clear:both;height:50px;}
..lft{float:left;width:200px;}
</style>
</head>
<body>
<div id="page">
<div id="header">Header</div>
<div id="left">
left<br />
left<br />
left<br />
left<br />
left<br />
left<br />
</div>
<div id="main">
<div class="lft">word1</div>
<div class="lft">word2</div>
<div class="lft">word3</div>
<div class="lft">word4</div>
<div class="lft">word5</div>
<div style="clear:left">This should be on a new line just below word5
but I cant use clear:left. If I use clear left the div drops below the
the div#left;</div>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>
See an example on arjenkarel.nl/test.php and arjenkarel.nl/test2.php
floortje
column top the left and adding a left margin to the main div.
The only problem is when I float divs in the main div I cant use
clear:left anymore since it does not only clear the floating divs in the
main div bu also the floating div outside the main div.
Does anymone know a workaround that lets me keep the left div floating ?
Here is the html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style>
#page{width:800px;margin 0 auto;}
#header{background-color:#1D1;height:50px;}
#left{background-color:#C2C;float:left;width:200px;}
#main{background-color:#EFE;margin-left:220px}
#footer{background-color:#ABA;clear:both;height:50px;}
..lft{float:left;width:200px;}
</style>
</head>
<body>
<div id="page">
<div id="header">Header</div>
<div id="left">
left<br />
left<br />
left<br />
left<br />
left<br />
left<br />
</div>
<div id="main">
<div class="lft">word1</div>
<div class="lft">word2</div>
<div class="lft">word3</div>
<div class="lft">word4</div>
<div class="lft">word5</div>
<div style="clear:left">This should be on a new line just below word5
but I cant use clear:left. If I use clear left the div drops below the
the div#left;</div>
</div>
<div id="footer">footer</div>
</div>
</body>
</html>
See an example on arjenkarel.nl/test.php and arjenkarel.nl/test2.php
floortje