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!

The 'annoying' IE/FireFox margin issues.

Status
Not open for further replies.

SamHale

MIS
Mar 7, 2004
71
GB
Ok, just a quick post to see if anyone knows.

I know the override for left margin for internet explorer
(display:inline;) but does anyone know the override to match the top margin between the two browsers?

Thanks,
Sam.
 
Try body { margin: 0; padding: 0;... in your stylesheet
or
<body style="margin: 0; padding: 0;">

That always seems to be a good place to start. IE tends to put margins on pretty much everything (obvious or not).

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Sorry, perhaps I should have said it was for a div, duh.

Code:
#select_box {
	width: 142px;
	height: 33px;
	float: left;
	margin-top: 7px; /* still has issues*/
	margin-left: 33px; /* now works fine*/
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #000000;
	font-size: x-small;
	display:inline;/* ie double margin bug*/
}
 
1. inline elements don't really have margins.

2. if you specify margin: 0; to your div, div will not have any margins in any browser.

3. if you put left margin on any block level element, all browsers will interpret that correctly.

4. if you join it all:

Code:
#select_box {
    width: 142px;
    height: 33px;
    float: left;
    margin: 7px 0px 0px 33px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #000000;
    font-size: x-small;
}
Now yell at person who told you that display: inline; helps here. Oh, as an aside, W3 says that display property is ignored if element is floated. So, you might have had display: dollar-bill; and it would render the same.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top