Hey guys, my old website was done in entirely tables and i’m working on updating it and making it use CSS. I was going well until I tried to add some content to the body. If I just add text it seems to be ok and scrolls. but when I added another container within my main body field it doesnt autoscroll the main container. and just floats the datea. I’msure that doesnt make too much sense so i will post the code. and here is the result
a:link {color:#FFFFFF;text-decoration:none;}
a:visited {color:#FFFFFF;text-decoration:none;}
a:hover {color:#CC0000;text-decoration:underline;}
a:active {color:#069;text-decoration:none;}
div.container {
font-size: 12px;
width: 680px ;
margin-left: auto ;
margin-right: auto ;
background-color: #ffe;
text-decoration: none;
}
div.float {
float: left;
padding-left: 20px;
height: 160px;
}
div.floatr {
float: right;
text-align: right;
padding-bottom:15px;
}
h1 {
font-family: Verdana, Geneva, sans-serif;
font-size: 16px;
margin-top:-5px;
margin-bottom:-5px;
}
h2 {
font-family: Verdana, Geneva, sans-serif;
font-size: 14px;
margin-top:-3px;
margin-bottom:-3px;
}
body {
background-color: #333;
margin-top: 0px;
margin-bottom: 0px;
}
#header {
height: 135px;
width: 800px;
overflow: hidden;
margin: 0;
text-align: center;
margin-left: auto;
margin-right: auto;
background: url('kitchen-worktops.jpg');
}
#mainback {
width: 800px;
margin-left: auto;
margin-right: auto;
background: url('worktops-background.jpg');
}
#maincontain {
width: 770px;
height: auto;
margin-left: auto;
margin-right: auto;
}
#footer {
width: 800px;
height: 50px;
background-color: black;
margin-left: auto;
margin-right: auto;
text-align: center;
color: white;
}
#menu{
padding:0;
margin:0;
}
#menu ul{
padding:0;
margin:0;
}
#menu li{
position: relative;
float: left;
list-style: none;
margin: 0;
padding:0;
}
#menu li a{
width:160px;
height: 25px;
display: block;
text-decoration:none;
text-align: center;
line-height: 25px;
background-color: black;
color: white;
}
#menu li a:hover{
background-color: red;
}
#menu ul ul{
position: absolute;
top: 25px;
visibility: hidden;
}
#menu ul li:hover ul{
visibility:visible;
}
<link href="styles.css" rel="stylesheet" type="text/css" />
<div id="header"></div>
<div id="mainback">
<div id="menu">
<ul>
<li><a href="#nogo">Kitchen Worktops</a>
<ul>
<li><a href="#nogo">Omega Worktops</a></li>
<li><a href="#nogo">Prima Worktops</a></li>
</ul>
</li>
<li><a href="#nogo">Worktop Samples</a>
</li>
<li><a href="#nogo">Request Quotation</a>
</li>
<li><a href="#nogo">Kitchen Doors</a>
</li>
<li><a href="#nogo">Contact Us</a>
<ul>
<li><a href="#nogo">Link 3-1</a></li>
<li><a href="#nogo">Link 3-2</a></li>
<li><a href="#nogo"></a></li>
</ul>
</li>
</ul>
</div>
<div id="maincontain">
<BR /><BR /><h2>Kitchen Worktops - Popular Choices</h2>
Posted by admin on 1 August 2011 | 3:27 am
<BR>
<?php
$connection = mysql_connect("localhost", "#######", "######");
if(!$connection){
die("database connection failed:". mysql_error());
}
$db_select = mysql_select_db("#########", $#######);
if(!$db_select){
die("database selecction failed:". mysql_error());
}
$sqtext = "SELECT *
FROM `worktops`
WHERE `range` = 'omega'";
$result = mysql_query($sqtext);
if(!$result){
die("database query failed:". mysql_error());
}
$Count = 0;
while($row = mysql_fetch_row($result))
{
echo'
<div class="container">
<div class="float">
<a href="'.$row[13].'">
<img src="http://www.worktopmagic.co.uk/omegaimg/'.$row[4].'" width="200" height="100"
alt="'.$row[2].' Worktops" border="1" /><br />
<a href="'.$row[13].'"><b>'.$row[2].'</b></a> '.$row[14].'<br />
Texture: '.$row[3].'
<div class="floatr">
'.$row[15].'
</div>
</div>
</div>
';
$Count++;
if ($Count > 5)
{
break;
}
}
?>
</div>
<BR />
<div id="footer">
<a href="http://www.worktopmagic.co.uk/privacy.php" rel="nofollow">Privacy Policy</a> | <a href="http://www.worktopmagic.co.uk/tandc.php" rel="nofollow">Terms and Conditions</a>
| <a href="http://www.worktopmagic.co.uk/sitemap.html">Site Map</a> | <a href="http://www.worktopmagic.co.uk/locations.php">Delivery Locations</a>
<BR>
<a href="http://www.worktopmagic.co.uk/KitchenArticles.php">Kitchen Articles / Reviews</a> | <a href="http://www.worktopmagic.co.uk/Kitchen-Sinks.php">Kitchen Sinks</a> | <a href="http://www.worktopmagic.co.uk/Kitchen-Taps.php">Kitchen Taps</a> | <a href="http://www.worktopmagic.co.uk/articles/">Kitchen DIY</a><BR><BR>
</div>