curt22 Posted September 1, 2007 Share Posted September 1, 2007 I'm making a simple page that uses css floats to align it and there is a large whitespace between two of my divs , could someone help me fix it. I've looked on google and tried a lot of things, but I haven't found anything. Xhtml <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="style.css" /> </head> <body> <div id="container"> <div id="sitename">Sitename</div> <div id="navigation"> <div id="mainnavigation"> <h3>Main Navigation</h3> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> <div class="latest"> <h3> Latest News</h3> News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here. </div> <div class="latest"> <h3>Links</h3> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> </div> <div id="content"> <h2>Content</h2> </div> </div> </body> </html> Css /* CSS Document */ body { font-family:Arial, Helvetica, sans-serif; color:#660000; } a:link{ color: #006699; text-decoration: none; } a:visited{ color: #006699; text-decoration: none; } a:hover{ color: #006699; text-decoration: underline; } #container{ width: 100%; } #sitename{ background-color:#33FF00; margin: 0px; padding: 10px 0 10px 10px; border-bottom: 1px solid #ccc; font-size: 36px; font-weight:bold; } #navigation{ float:left; width:175px; background-color: #33FF00; margin: 0px; } #navigation ul a:link, #navBar ul a:visited { display: block; } #navigation ul { list-style: none; margin: 0; padding: 0; } #navigation li { border-bottom: 1px solid #EEE; } html>body #navigation li { border-bottom: none; } #mainnavigation{ margin: 0px; padding: 0px; border-bottom: 1px solid #cccccc; font-size: 90%; } #mainnavigation h3{ padding: 10px 0px 2px 10px; margin:0px; } #mainnavigation a { display: block; padding: 2px 0px 2px 10px; } #mainnavigation a:hover{ background-color: #dddddd; } .latest{ float:left; margin: 0px; padding: 0px 0px 1px 1px; font-size: 90%; border-bottom:1px solid #cccccc; } #content { margin: 0px 0px 0px 5px; background-color:#33FF00; border-left:1px solid #cccccc; vertical-align:top; } #content h2 { text-align:center; } Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/ Share on other sites More sharing options...
curt22 Posted September 1, 2007 Author Share Posted September 1, 2007 I fixed it with this, but now I'm having a new problem border-left isn't working on #content. /* CSS Document */ body { font-family:Arial, Helvetica, sans-serif; color:#660000; } a:link{ color: #006699; text-decoration: none; } a:visited{ color: #006699; text-decoration: none; } a:hover{ color: #006699; text-decoration: underline; } #container{ width: 100%; margin: 0; } #sitename{ background-color:#33FF00; margin: 0; padding: 10px 0 10px 10px; border-bottom: 1px solid #ccc; font-size: 36px; font-weight:bold; } #navigation{ float:left; width:175px; background-color: #33FF00; margin: 0px; } #navigation ul a:link, #navBar ul a:visited { display: block; } #navigation ul { list-style: none; margin: 0; padding: 0; } #navigation li { border-bottom: 1px solid #EEE; } html>body #navigation li { border-bottom: none; } #mainnavigation{ margin: 0px; padding: 0px; border-bottom: 1px solid #cccccc; font-size: 90%; } #mainnavigation h3{ padding: 5px 0px 2px 5px; margin:0px; } #mainnavigation a { display: block; padding: 2px 0px 2px 10px; } #mainnavigation a:hover{ background-color: #dddddd; } .latest{ float:left; margin: 0px; padding: 0px 0px 0px 0px; font-size: 90%; border-bottom:1px solid #cccccc; } #content { margin: 0px 0px 0px 5px; background-color:#33FF00; vertical-align:top; border-left: 1px solid #cccccc; } #content h2 { text-align:center; margin: 0; } Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/#findComment-339466 Share on other sites More sharing options...
TheFilmGod Posted September 1, 2007 Share Posted September 1, 2007 You need to clean your code up. I spent 10 minutes trying to figure what div goes for what. The names are horrible for the id's. And the code is jumbled up. On a side note, the colors are horrible on the eyes... Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/#findComment-339484 Share on other sites More sharing options...
curt22 Posted September 2, 2007 Author Share Posted September 2, 2007 Ok Thanks TheFilmGod I'll clean it up a little and post it again. Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/#findComment-339526 Share on other sites More sharing options...
curt22 Posted September 2, 2007 Author Share Posted September 2, 2007 I tried to clean it up a little and I made the colors darker. I know it's still confusing but could you please help anyway. Here's the new code. Xhtml <!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"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="style.css" /> </head> <body> <div id="container"> <div id="sitename"> Sitename </div> <div id="navigation"> <div id="mainnavigation"> <h3>Main Navigation</h3> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> <div class="latest"> <h3> Latest News</h3> News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here.News Goes here. </div> <div class="latest"> <h3>Links</h3> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> </div> <div id="content"> <h2>Content</h2> </div> </div> </body> </html> Css /* CSS Document */ body { font-family:Arial, Helvetica, sans-serif; color:#DA8750; } a:link{ color:#DA8750; text-decoration: none; } a:visited{ color: #DA8750; text-decoration: none; } a:hover{ color: #DA8750; text-decoration: underline; } #container{ width: 100%; margin: 0; } #sitename{ background-color:#006600; margin: 0; padding: 10px 0 10px 10px; border-bottom: 1px solid #ccc; font-size: 36px; font-weight:bold; } #navigation{ float:left; width:175px; background-color: #006600; margin: 0px; } #navigation ul a:link, #navBar ul a:visited { display: block; } #navigation ul { list-style: none; margin: 0; padding: 0; } #navigation li { border-bottom: 1px solid #EEE; } html>body #navigation li { border-bottom: none; } #mainnavigation{ margin: 0px; padding: 0px; border-bottom: 1px solid #cccccc; font-size: 90%; } #mainnavigation h3{ padding: 0px 0px 0px 0px; margin:7px 0 7px 0; } #mainnavigation a { display: block; padding: 2px 0px 2px 10px; } #mainnavigation a:hover{ background-color: #DA8750; color:#006600; } .latest{ float:left; margin: 0px; padding: 0px 0px 0px 0px; font-size: 90%; border-bottom:1px solid #cccccc; } .latest h3{ margin:7px 0 7px 0; padding:0 0 0 0; } #content { margin: 0px 0px 0px 5px; background-color:#006600; vertical-align:top; border-left: 1px solid #cccccc; } #content h2 { text-align:center; margin: 0; } Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/#findComment-339542 Share on other sites More sharing options...
curt22 Posted September 2, 2007 Author Share Posted September 2, 2007 I decided to add a border on the right of #navigation instead on the left off #content. Quote Link to comment https://forums.phpfreaks.com/topic/67564-solved-problem-with-white-space-xhtml-page/#findComment-339941 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.