I'm trying to only use CSS for this layout, and this is my first real attempt at doing it.
Surprisngly, the layout is flawless in IE, but not in Opera or Firefox, and I'm using Opera for testing.
What I'm trying to do is have two div's positioned side by side. The problem is that if I float them (Which is the only way I know of doing it) they just sit there, overlapping the footer, as as shown here
Now, if I clear the footer, they don't overlap it anymore, but the main container with the white background isn't pushed down either, as hown here.
How would I adjust my code so that the main container containing the white background will be pushed down as well?
HTML
CSSCode:<!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' /> <title>My Site</title> <link href='style.css' rel='stylesheet' type='text/css' media='all' /> </head> <body> <div id='container'> <div id='intro'> <div id='header'> </div> <div id='main-nav'> <ul> <li id='selected'><a href='#'>Home</a></li> <li><a href='#'>Blogs</a></li> <li><a href='#'>Forums</a></li> <li><a href='#'>Groups</a></li> <li><a href='#'>News</a></li> <li><a href='#'>Videos</a></li> <li><a href='#'>Music</a></li> <li><a href='#'>Photos</a></li> <li><a href='#'> Sites</a></li> </ul> </div> </div> <div id='container-main'> <div id='main'> <div id='blogs'> <div class='title'> Hot Blogs </div> <div class='body-all'> This is the total body for blogs </div> </div> <div id='forums'> <div class='title'> Hot Forums </div> <div class='body-all'> This is the total body for forums </div> </div> </div> </div> <div id='footer'> <div id='copyright'> Copyright © 2006 Douglas Brunner. All right reserved. </div> </div> </div> </body> </html>
Code:html { margin: 0px; padding: 0px; } body { margin: 0px; padding: 0px; font-size: .8em !important; color: #333333; background: #e7e7e7;; font: small verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif; } #container { width: 100%; margin: 0px; padding: 0px; text-align: left; } #intro { height: 99px; background: url("images/header/bg.jpg"); } #header { height: 70px; width: 778px; margin: auto auto; background: url("images/header/logo.png") no-repeat; _background: url("images/header/logo.gif") no-repeat; } /* * * Main Navigation * */ #main-nav { width: 776px; margin: auto auto; font-size: 12px; } #main-nav ul { padding: 0px; margin: 0px; height: 29px; list-style: none; border-left: 1px #333333 solid; } #main-nav ul li { margin: 0px; height: 29px; float: left; line-height: 29px; text-align: center; border-right: 1px #333333 solid; } #main-nav ul li a { display: block; padding-left: 23px; padding-right: 23px; color: #000000; text-decoration: none; } #main-nav ul li a:hover { background: url("images/header/nav-hover.jpg"); color: #000000; } #main-nav ul li a:visited { color: #800080; text-decoration: none; } #main-nav ul li#selected { background: url("images/header/nav-selected.jpg"); } #main-nav ul li#selected:hover { background: url("images/header/nav-hover.jpg"); } /* * * Main Body * */ #container-main { background: url("images/bg.jpg"); } #main { padding: 7px; width: 759px; _width: 760px; margin: auto auto; background: #ffffff; border-left: 1px #333333 solid; border-right: 1px #333333 solid; clear: both; } .title { padding-left: 5px; height: 22px; font-size: .85em; line-height: 22px; background: url("images/title.png"); border-left: 1px #333333 solid; border-right: 1px #333333 solid; } .body-all { border-bottom: 1px #333333 solid; border-left: 1px #333333 solid; border-right: 1px #333333 solid; } /* * * Footer * */ #footer { height: 30px; background: url("images/footer.jpg"); font-size: 12px; clear: both; /* Cleared Footer */ } #copyright { width: 773px; _width: 774px; margin: auto auto; padding-left: 5px; font-size: .8em; line-height: 30px; } /* * * Homepage Specific * */ div#blogs { position:relative; width: 300px; float: left; } div#forums { width: 300px; float: right; }





Bookmarks