Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



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: 250
Name: Tom Maurer
Location: Pennslvania, USA
Trades: 0
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
 
 
Register now for full access!
Old 01-25-2007, 05:07 PM Re: IE adding extra margin on me...
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
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 !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

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: 250
Name: Tom Maurer
Location: Pennslvania, USA
Trades: 0
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
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Big John's site is my go-to for IE bug fixing
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

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
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

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





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



Page generated in 0.15097 seconds with 12 queries