I am trying to learn css. up to now I have been lagging behind and using tables to manage my page layout.
I want to migrate to css but am having a few issues aceiving this.
My current page layout using a table:

I tried to recreate this layout using css as per code below:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>page layout</title>
<style type="text/css">
html, body {
text-align:center;
}
#wrapper {
margin: 0 auto;
width: 1200px;
text-align:left;}
#header {
height: 100px;
overflow: auto;
background: green;
}
#main {
background: yellow;
float: left;
width: 800px;
height: 400px
}
#menu {
background: red;
float: left;
width: 200px;
height: 200px
}
#pics {
background: brown;
float: left;
width: 200px;
height: 200px
}
#pics {
background: brown;
float: left;
width: 200px;
height: 200px
}
#adverts {
background: pink;
float: left;
width: 200px;
height: 400px
}
#footer {
background: grey;
float: left;
width: 1200px;
height: 100px
}
</style>
</head>
<body>
<div id="header">
Header
</div>
<div id="menu">
menu
</div>
<div id="pics">
pics
</div>
<div id="main">
main
</div>
<div id="adverts">
adverts
</div>
<div id="footer">
footer
</div>
</body>
</html>
This produces the following output:

As you can see the pics div is in the incorrect place, this should be under the menu div not at the bottom of the page?
My questions, how do I get the pics div in the correct place? and secondly how do I center the entire page?
Lastly, is this the best method of managing my page layout? what will happen in the event that my ‘main’ div is too full of information? will it autoadjust its height in order to display all the info? is this what the overflow: auto will allow?
Appreciate the help as always,
R
Your
picsdiv is out of sequence. It needs to appear before thefooterdiv:You have this:
You need to have this:
In order to get the
menuandpicsdivs arranged the way you want, create adivthat wraps (contains) them both (menupicsin my CSS/HTML below).This code works just as you have it laid out above: