Jump to content


CSS layout help! Weird additional space added


1 reply to this topic

#1 g18c

    Young Padawan

  • Members
  • Pip
  • 1 posts

Posted 14 August 2005 - 09:25 AM

Hi, i'm having a big problem yet cant seem to work out what im doing wrong!!

I am desiging a site, which has a menu which is floated. I want the design to have a floated menu, however it is causing me grief.

When here is no menu (see link), everything is layed out fine.
http://www.monsterserve.net/nomenu.htm

When i incldue the floating menu, for some reason there is additional height added in the spacer div (again see link)
http://www.monsterse...et/withmenu.htm

Cant work out for the life of me why it should be adding height, it does it in ie6 and firefox

Also, how would i go about floating the submenu to the right, and adding a little space between the submenu bottom and the paragraph?

Code for site can be got from links, or from include below:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">

p{
	margin: 0px;
	padding:0px;
	text-align: justify;
}

#submenu
{
	width:200px;
	height:200px;
	border: 1px solid black;
}

body
{
	margin:0px;
	padding:0px;
	font-family: Tahoma, Arial,sans-serif;
	font-size: 11px;
}

#container
{
	width: 800px;
	margin-left: auto;
	margin-right: auto;
	margin-top: 10px; /* offset 10px from page top */
	text-align:left;
	border: 1px solid black;
}

#menu
{
	position:relative;
	width:275px;
	height:20px;
	border: 1px solid black;
	left: 76px;
	top: 44px;
}

#left
{
float:left;
width:400px;
margin: 0px;
}

#right
{
	margin-left: 400px;
	padding: 10px;
	border-left: 1px solid black;
}

#spacer
{
	height:30px;
	border-bottom: 1px solid black;
}

</style>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<div id="container">
	<div id="menu">menu</div>
	<div id="spacer">spacer</div>
	<div id="left">picture</div>
	<div id="right">
  <div id="submenu">submenu</div>
  <p>
 	 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec molestie. Sed aliquam sem ut arcu.
 	 Phasellus sollicitudin. Vestibulum condimentum facilisis nulla. In hac habitasse platea dictumst.
 	 Nulla nonummy. Cras quis libero. Cras venenatis. Aliquam posuere lobortis pede. Nullam fringilla
 	 urna id leo. Praesent aliquet pretium erat. Praesent non odio. Pellentesque a magna a mauris
 	 vulputate lacinia. Aenean viverra. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
 	 per inceptos hymenaeos. Aliquam lacus. Mauris magna eros, semper a, tempor et, rutrum et, tortor
  </p>
         </div> <!-- end right div -->
</div> <!-- end container div -->
</body>
</html>

Many thanks in advance, hopefully someone can help me before i go insane!!

Cheers,

Chris

#2 lajkonik86

    Young Padawan

  • Members
  • Pip
  • 12 posts

Posted 14 August 2005 - 09:35 AM

only scanned your post but sounds a lot like ie double margin bug

When floating and having a margin or padding at the same side
something like float left margin-left: 5 etc.
Ie will render the margin as 10

To stop this problem from happening set display:inline;
as the first declaration of the floating element





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users