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

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.