Click here to get back home

Default top and bottom margin disappear in IE7: why

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Default top and bottom margin disappear in IE7: why GTalbot 11-09-2007
Posted by GTalbot on November 9, 2007, 11:44 pm
Please log in for more thread options
[followup-to set to comp.infosystems.www.authoring.html]
Hello fellow HTML and markup coder colleagues,

Please visit this url:

http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForPargDis=
appear.html

I would appreciate it if someone could explain

1- why MSIE 7 render this simple webpage so differently from Firefox
2=2E0.0.9, Opera 9.50, Safari 3.0.3?

2- If this is due to a bug in MSIE7? If so, which one?

3- When querying the currentStyle of margin-top and margin-bottom of
#OrdinaryPargLime with IE developer toolbar or by querying with
currentStyle.marginTop, the value returned is "auto". When creating a
nested <p> with margin declaratively set to auto inside a div with
Parent-Floated-Yellow-Div class, then the top margin and bottom margin
suddenly occur in MSIE7 but are removed in other browsers (Firefox
2=2E0.0.9, Opera 9.50, Safari 3.0.3).

What I am trying to say is this: in MSIE 7, the current style values
of margin-top and margin-bottom for #OrdinaryPargLime and for
#OrdinaryPargWithMarginAutoOrange are the exactly the same: auto but
even for MSIE 7, those 2 paragraphs' vertical margins are rendered
very differently.

4- In MSIE 7, paragraphs have default margins. Why are they removed
(at least not visible, not rendered) for #OrdinaryPargLime ?

Best regards,

G=E9rard
[followup-to set to comp.infosystems.www.authoring.html]


Posted by Ben C on November 10, 2007, 5:27 am
Please log in for more thread options
> [followup-to set to comp.infosystems.www.authoring.html]
> Hello fellow HTML and markup coder colleagues,
>
> Please visit this url:
>
>
http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForPargDisappear.html
>
> I would appreciate it if someone could explain
>
> 1- why MSIE 7 render this simple webpage so differently from Firefox
> 2.0.0.9, Opera 9.50, Safari 3.0.3?
>
> 2- If this is due to a bug in MSIE7? If so, which one?

Clearly it is a bug. OrdinaryPargLime should have <p>'s default margins
(usually 1.12em top and bottom, but that's up to the browser), and
OrdinaryPargWithMarginAutoOrange should have no margins because you set
them to auto.

CSS 2.1 10.6.3:

If 'margin-top', or 'margin-bottom' are 'auto', their used value is
0.

> 3- When querying the currentStyle of margin-top and margin-bottom of
> #OrdinaryPargLime with IE developer toolbar or by querying with
> currentStyle.marginTop, the value returned is "auto".

So far so good. If the default really is auto, it should render as it
has done-- with no margins.

The first test (OrdinaryPargLime) can be considered "passed but
suspicous"-- because we know really that <p> is supposed to have some
default margins.

> When creating a nested <p> with margin declaratively set to auto
> inside a div with Parent-Floated-Yellow-Div class, then the top margin
> and bottom margin suddenly occur in MSIE7 but are removed in other
> browsers (Firefox 2.0.0.9, Opera 9.50, Safari 3.0.3).

As they should be.

> What I am trying to say is this: in MSIE 7, the current style values
> of margin-top and margin-bottom for #OrdinaryPargLime and for
> #OrdinaryPargWithMarginAutoOrange are the exactly the same: auto but
> even for MSIE 7, those 2 paragraphs' vertical margins are rendered
> very differently.

It looks like MSIE7 is very confused.

> 4- In MSIE 7, paragraphs have default margins. Why are they removed
> (at least not visible, not rendered) for #OrdinaryPargLime ?

Who knows? Perhaps it's applying the selector to the wrong <p>. If you
delete the second paragraph altogether perhaps the first one sorts
itself out?

Posted by GTalbot on November 10, 2007, 4:50 pm
Please log in for more thread options
>
> > [followup-to set to comp.infosystems.www.authoring.html]
> > Hello fellow HTML and markup coder colleagues,
>
> > Please visit this url:
>
> >http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForP...
>
> > I would appreciate it if someone could explain
>
> > 1- why MSIE 7 render this simple webpage so differently from Firefox
> > 2.0.0.9, Opera 9.50, Safari 3.0.3?
>
> > 2- If this is due to a bug in MSIE7? If so, which one?
>
> Clearly it is a bug. OrdinaryPargLime should have <p>'s default margins
> (usually 1.12em top and bottom, but that's up to the browser),

Hello again Ben :)

I have tried to query these default top and bottom margin values with
currentStyle.marginTop but all I got was "auto" (which can not be
resolved to something concrete, queryable from IE7) when Firefox gave
16px and Safari gave 17px when using

document.defaultView.getComputedStyle(document.getElementById("OrdinaryParg=
Lime"),
null).marginTop

document.defaultView.getComputedStyle(document.getElementById("OrdinaryParg=
Lime"),
null).marginBottom


> and
> OrdinaryPargWithMarginAutoOrange should have no margins because you set
> them to auto.
>
> CSS 2.1 10.6.3:
>
> If 'margin-top', or 'margin-bottom' are 'auto', their used value is
> 0.


Ben, this is extremely helpful info. I truly appreciate this.


> > 3- When querying the currentStyle of margin-top and margin-bottom of
> > #OrdinaryPargLime with IE developer toolbar or by querying with
> > currentStyle.marginTop, the value returned is "auto".
>
> So far so good. If the default really is auto, it should render as it
> has done-- with no margins.
>
> The first test (OrdinaryPargLime) can be considered "passed but
> suspicous"-- because we know really that <p> is supposed to have some
> default margins.
>
> > When creating a nested <p> with margin declaratively set to auto
> > inside a div with Parent-Floated-Yellow-Div class, then the top margin
> > and bottom margin suddenly occur in MSIE7 but are removed in other
> > browsers (Firefox 2.0.0.9, Opera 9.50, Safari 3.0.3).
>
> As they should be.
>
> > What I am trying to say is this: in MSIE 7, the current style values
> > of margin-top and margin-bottom for #OrdinaryPargLime and for
> > #OrdinaryPargWithMarginAutoOrange are the exactly the same: auto but
> > even for MSIE 7, those 2 paragraphs' vertical margins are rendered
> > very differently.
>
> It looks like MSIE7 is very confused.
>
> > 4- In MSIE 7, paragraphs have default margins. Why are they removed
> > (at least not visible, not rendered) for #OrdinaryPargLime ?
>
> Who knows? Perhaps it's applying the selector to the wrong <p>. If you
> delete the second paragraph altogether perhaps the first one sorts
> itself out?

If I delete the second (the orange one) paragraph, this is what I get:

When #OrdinaryPargLime is alone:
http://www.gtalbot.org/BrowserBugsSection/OrdinaryPargLimeOnly.html

When #OrdinaryPargWithMarginAutoOrange is alone:
http://www.gtalbot.org/BrowserBugsSection/OrdinaryPargWithMarginAutoOrangeO=
nly.html

Regards, G=E9rard
--
Internet Explorer 7 bugs: http://www.gtalbot.org/BrowserBugsSection/MSIE7Bu=
gs/


Posted by Ben C on November 13, 2007, 12:15 pm
Please log in for more thread options
>>
>> > [followup-to set to comp.infosystems.www.authoring.html]
>> > Hello fellow HTML and markup coder colleagues,
>>
>> > Please visit this url:
>>
>> >http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForP...
>>
>> > I would appreciate it if someone could explain
>>
>> > 1- why MSIE 7 render this simple webpage so differently from Firefox
>> > 2.0.0.9, Opera 9.50, Safari 3.0.3?
>>
>> > 2- If this is due to a bug in MSIE7? If so, which one?
>>
>> Clearly it is a bug. OrdinaryPargLime should have <p>'s default margins
>> (usually 1.12em top and bottom, but that's up to the browser),
>
> Hello again Ben :)
>
> I have tried to query these default top and bottom margin values with
> currentStyle.marginTop but all I got was "auto" (which can not be
> resolved to something concrete, queryable from IE7) when Firefox gave
> 16px and Safari gave 17px when using
>
>
document.defaultView.getComputedStyle(document.getElementById("OrdinaryPargLime"),
> null).marginTop
>
>
document.defaultView.getComputedStyle(document.getElementById("OrdinaryPargLime"),
> null).marginBottom

I think getting a value of "auto" is another bug in itself--
getComputedStyle is meant to give you the computed style, which for a
margin, should be either a number of pixels or a percentage. If you've
set margin: auto, then you should get however many pixels the margin
turned out to be (in this case auto should compute to 0, so you should
get "0" or "0px").

Posted by GTalbot on November 10, 2007, 6:47 pm
Please log in for more thread options
>
> > [followup-to set to comp.infosystems.www.authoring.html]
> > Hello fellow HTML and markup coder colleagues,
>
> > Please visit this url:
>
> >http://www.gtalbot.org/BrowserBugsSection/DefaultTopBottomMarginsForP...
>
> > I would appreciate it if someone could explain
>
> > 1- why MSIE 7 render this simple webpage so differently from Firefox
> > 2.0.0.9, Opera 9.50, Safari 3.0.3?
>
> > 2- If this is due to a bug in MSIE7? If so, which one?
>
> Clearly it is a bug. OrdinaryPargLime should have <p>'s default margins
> (usually 1.12em top and bottom, but that's up to the browser), and
> OrdinaryPargWithMarginAutoOrange should have no margins because you set
> them to auto.
>
> CSS 2.1 10.6.3:
>
> If 'margin-top', or 'margin-bottom' are 'auto', their used value is
> 0.

[snipped]

I have filed 2 distinct bug report/testcases for this:

http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/OrdinaryPargWithMarginA=
uto.html

http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/DefaultMarginDisappear.=
html

All other browsers (except IE) pass these 2 tests.

Regards, G=E9rard


Similar ThreadsPosted
What good is margin-bottom in IE? November 3, 2004, 1:28 pm
Making default entry in search text box disappear on click June 30, 2005, 4:10 am
margin above of

August 23, 2007, 5:15 am
Trying to align something at the very bottom August 19, 2006, 3:50 pm
Bottom of RSS Feed cut-off? May 25, 2007, 10:08 am
div align bottom inside a td February 5, 2006, 7:27 pm
CSS: border-bottom not showing up??? May 7, 2007, 5:41 am
How to push elements to the bottom August 21, 2007, 6:07 am
Keeping the footer at the bottom April 25, 2008, 8:09 pm
Help with Firefox margin issue August 30, 2005, 5:26 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap