By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,790 Members | 1,107 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,790 IT Pros & Developers. It's quick & easy.

Why doesn't Mozilla collapse vertical margins between <table> and other blocks?

P: n/a
I have these styles:

p, pre, table { margin: 1em; }

And this HTML:

<p>A paragraph</p>
<table><tr><td>A table</td></tr></table>
<pre>A preformatted block</pre>
<p>A paragraph</p>

In IE6, the vertical space between all blocks is 1em. But in
Netscape/Firebird, there's 2em space before and after the table. Why
don't the margins collapse? What's the CSS for "at least 1em margin
around all blocks"?
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <83*************************@posting.google.com> in
comp.infosystems.www.authoring.stylesheets, Michael Liu
<pr*********@hotmail.com> wrote:
But in
Netscape/Firebird, there's 2em space before and after the table.


I haven't seen that in my own pages, and you didn't give us a URL.

Perhaps you should try setting padding to 0?

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #2

P: n/a
Stan Brown <th************@fastmail.fm> wrote in message news:<MP************************@news.odyssey.net> ...
In article <83*************************@posting.google.com> in
comp.infosystems.www.authoring.stylesheets, Michael Liu
<pr*********@hotmail.com> wrote:
But in
Netscape/Firebird, there's 2em space before and after the table.


I haven't seen that in my own pages, and you didn't give us a URL.

Perhaps you should try setting padding to 0?


Thanks for replying.

Here's a URL: http://home.pacbell.net/nexus/temp.html
Setting padding to 0 (as done in this page) doesn't seem to help.

I viewed this page in IE6 SP1 and Firebird 0.7 on Windows XP. I
didn't try it with this particular page, but a similar problem
occurred on another page with Netscape 7.1.
Jul 20 '05 #3

P: n/a
pr*********@hotmail.com (Michael Liu) wrote:
Michael Liu <pr*********@hotmail.com> wrote:
>
> But in
>Netscape/Firebird, there's 2em space before and after the table.


Here's a URL: http://home.pacbell.net/nexus/temp.html
Setting padding to 0 (as done in this page) doesn't seem to help.

I viewed this page in IE6 SP1 and Firebird 0.7 on Windows XP. I
didn't try it with this particular page, but a similar problem
occurred on another page with Netscape 7.1.


The problem vanishes if you set table to display: block, and appears
between two adjacent paragraphs if p is set to display: table.

I believe this is a bug in Gecko's handling of display: table as the
CSS specs seem to be clear that display: table generates a block level
box and that vertical margins of block level boxes should be
collapsed.
http://www.w3.org/TR/CSS2/tables.html#q2
http://www.w3.org/TR/CSS2/box.html#x24
http://www.w3.org/TR/CSS2/visuren.html#q5

For more information on whether this is a bug and whether it's likely
to be fixed soon I'd suggest searching Bugzilla or asking on a Mozilla
newsgroup.

Any work around would depend on your particular design. In the simple
test case given here setting table {margin: 0 1em} would suffice.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #4

P: n/a
Steve Pugh <st***@pugh.net> wrote in message news:<jl********************************@4ax.com>. ..
The problem vanishes if you set table to display: block, and appears
between two adjacent paragraphs if p is set to display: table.

I believe this is a bug in Gecko's handling of display: table as the
CSS specs seem to be clear that display: table generates a block level
box and that vertical margins of block level boxes should be
collapsed.


Thanks for replying. I looked up this bug in Bugzilla:
http://bugzilla.mozilla.org/show_bug.cgi?id=87277
It was reported more than two years ago, but still hasn't been fixed.
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.