CSS Problem - probably an easy one

Associate
Joined
27 Jun 2006
Posts
1,473
I have the following web page (ignore all colours, for my guide only :)):

http://www.fatboy.me.uk/new

Now it displays properly (or at least how I expected) in IE7 (i was shocked!) but in FF, the 2 inner boxes come out of the main container box

HTML Source:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> CSS Test </TITLE>
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <LINK REL=StyleSheet HREF="styles/mainstyle.css" TYPE="text/css" MEDIA=screen>
 </HEAD>

 <BODY>
  
	<div id="container">
		
		<div id="logo"><img src="images/logo.jpg"></div>
		<div id="nav">this is the nav part</div>

	</div>

 </BODY>
</HTML>

And the style sheet:

Code:
#container
{
	width: 780px;
	padding: 5px;
	background: #cccccc;
	border: 1px solid #000;
}

body
{
	font-family: arial, verdana, sans-serif;
	font-size: 10px;
}

#logo
{
	width:250px;
	float:left;
}

#nav
{
	padding-top: 62px;
	text-align: right;
	width: 500px;
	background: #ef54ee;
	float: right;
}

Any suggestions why it won't display right appreciated!!

M.
 
Last edited:
That's standard behaviour. Floated elements are removed from the document flow - so as far as #container's concerned, neither #logo or #nav exists and space doesn't need to be reserved for them (not entirely accurate, but the best way I could think to explain).

So, un-float one of your elements i.e. #nav, replacing float: right; with margin-left: 280px;.
 
Back
Top Bottom