Reply
IE adding extra margin on me...
Old 01-25-2007, 01:45 PM IE adding extra margin on me...
Tom_M's Avatar
Ultra Talker

Posts: 251
Name: Tom Maurer
Location: Pennslvania, USA
I am trying to figure out why IE is messing this simple layout. It has to be something very simple, but I can't find it.

The site:
http://www.altoonafirefighters.org/test/temp.php

Firefox is displaying it correctly, but IE 6 is messing up my margins for some reason. I'm specifying 10px left margin on the mainNav div, and IE 6 is adding 20px margin?

The layout.css:
Code:
/* Main Layout Styles */
#header {
	width: 980px;
	margin-bottom: 20px;
	border: 1px solid silver;
}

#wrapper {
	width: 980px;
}

#content {
	width: 760px;
	margin-bottom: 20px;
	float: right;
}

#mainContent {
	width: 540px;
	float: left;
	border: 1px solid silver;
}

#rightColumn {
	width: 190px;
	float: right;
	border: 1px solid silver;
}

#mainNav {
	width: 190px;
	float: left;
	margin: 0 0 20px 10px;
	border: 1px solid silver;
}

#footer {
	clear: both;
	border: 1px solid silver;
}

Last edited by Tom_M : 01-25-2007 at 03:26 PM.
Tom_M is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-25-2007, 05:07 PM Re: IE adding extra margin on me...
LadynRed's Avatar
Super Moderator

Posts: 6,743
Location: Tennessee
Easy answer - doubled-float margin bug in IE.

This bug occurs when you have an element floated and then apply a margin in the same direction as the float.

In your case, you have #mainNav floated left then you apply a 10px left margin to it. IE DOUBLES that margin to 20px ! Same happens if you float right.

The fix ? Add height: 1% to the #mainNav rules. However, you should put that in in a 'iefixes.css' file (or whatever you want to name it) and add in the necessary conditional comment to make IE obey this additional rule. That leaves your main cSS file free of hacks that other browsers don't need.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 01-25-2007, 10:42 PM Re: IE adding extra margin on me...
Tom_M's Avatar
Ultra Talker

Posts: 251
Name: Tom Maurer
Location: Pennslvania, USA
Thanks for the reply. I had already solved it though. I should have known it was an IE bug. But it was the last thing I checked for some reason.

The solution I used is found here:
http://www.positioniseverything.net/...ed-margin.html

It involves applying a { display: inline; } rule to all the affected divs.
Tom_M is offline
Reply With Quote
View Public Profile
 
Old 01-27-2007, 11:22 AM Re: IE adding extra margin on me...
LadynRed's Avatar
Super Moderator

Posts: 6,743
Location: Tennessee
Big John's site is my go-to for IE bug fixing
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 02-01-2007, 12:53 AM Re: IE adding extra margin on me...
Junior Talker

Posts: 2
You can try by putting "display:inline" in the div mainnav

I think it may work
vissu is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to IE adding extra margin on me...
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12606 seconds with 12 queries