Jump to content

[SOLVED] problem with white space xhtml page


curt22

Recommended Posts

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;
}

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;
}

 

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;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.