Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why the gap?

Status
Not open for further replies.

seanybravo

IS-IT--Management
Sep 24, 2003
89
GB
I am training myself to use css in my web pages and everytime I think that I am getting an understanding of it something does not work as expected. Could someone please tell me why there is a gap between the header and the Navigation Divs? My knowledge of css tells me that there should not.

I hae tried both Mac Safari 1.3.1 and PC IE 6.0.2.

If anyone can offer an explination why this is happening I would be very grateful. There is only a small amount of code.

Thanks

Sean

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Page Layout Tutorial</title>
<style type="text/css">
<!--
Body{ background-image:url(Background.gif); text-align:center;
}

#wrapper{background-color:#FFFFFF; width:600px; margin-left:auto; margin-right:auto; padding:0px;
}

#footer{ background-color:#000066; color:#FFFFFF; width:600px;
}

#header{ padding:0px; margin:0px;
}

#navigation{ padding:0px; margin:0px 0 0 0px;
}

-->
</style>
</head>

<body>

<div id="wrapper">

<div id="header"><img src="Header.jpg" width="600" height="100" /></div>

<div id="navigation"><ul id="navlist"><li id="active"><a href="#" id="current">Home</a></li>
<li><a href="#">Page1</a></li>
<li><a href="#">Page2</a></li>
<li><a href="#">Page3</a></li>
</ul>
</div>

<div id="footer">
Footer
</div>
</div>
</body>
</html>
 
It might well be because of the way certain browsers handle whitespace. Try this if Jeff's CSS fix doesn't work:

Code:
 <div id="header"><img src="Header.jpg" width="600" height="100" />[b</div><div id="navigation">[/b]

(i.e. removing whitespace between closing div of header, and opening div of navigation).

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks both Jeff's solution worked.

Regards

Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top