Connecting Tech Pros Worldwide Help | Site Map

Table Margin Inside Multiple Div Problem on IE

tbcarver@yahoo.com
Guest
 
Posts: n/a
#1: Aug 17 '05
I have a table that I am trying to add a bottom margin to in IE. I
have found that if the table is inside more than 1 div then the shape
of the containing div collapses.

Please look at this example in IE and then in FireFox:

Table inside 1 Div:
http://hughaxton.com/NewsGroups/IE1DivTable.html

Table inside 2 Divs:
http://hughaxton.com/NewsGroups/IE2DivsTable.html

I could not find any information about this problem. Your help is
appreciated.

Thanks,
Tyler

logic_earth
Guest
 
Posts: n/a
#2: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


give div2 a border or padding

http://www.complexspiral.com/publica...psing-margins/

tbcarver@yahoo.com
Guest
 
Posts: n/a
#3: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


This issue seems to be more of a bug than a feature. It does not seem
to fall under the Uncollapsing Margins. As this example shows adding
padding or borders has no affect upon the issue.

http://hughaxton.com/NewsGroups/BorderIE2DivsTable.html

Els
Guest
 
Posts: n/a
#4: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


tbcarver@yahoo.com wrote:
[color=blue]
> This issue seems to be more of a bug than a feature. It does not seem
> to fall under the Uncollapsing Margins. As this example shows adding
> padding or borders has no affect upon the issue.
>
> http://hughaxton.com/NewsGroups/BorderIE2DivsTable.html[/color]

Please quote what you are replying to? I now had to find out what you
were on about from previous postings.
And don't blame it on Google Groups, as you can read here:
http://www.safalra.com/special/googlegroupsreply/

Anyway, your problem is that the inner div collapses when placed
between the table and the outer div.

What is happening, is the inner div letting the margin of the table go
outside its border.

Just set a height to the inner div (any height, I usually use 1%, but
you have to hide that style from other browsers), and it conforms to
what Firefox and Opera do.
Now you'll probably ask why the outer div when it was by itself,
didn't show the same problem. That's because you set a width on it.
Either width or height makes the box encompass its contents, whether
those contents include elements with margins, or even floats. In WinIE
that is!

HTH

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
boclair
Guest
 
Posts: n/a
#5: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


tbcarver@yahoo.com wrote:[color=blue]
> I have a table that I am trying to add a bottom margin to in IE. I
> have found that if the table is inside more than 1 div then the shape
> of the containing div collapses.
>
> Please look at this example in IE and then in FireFox:
>
> Table inside 1 Div:
> http://hughaxton.com/NewsGroups/IE1DivTable.html
>
> Table inside 2 Divs:
> http://hughaxton.com/NewsGroups/IE2DivsTable.html[/color]

Collapsing margin between table and inner div.

You might add the rule zoom:1 to the class selector wrapperInside, or

you might add the following the non rule _height:1px to the class
selector wrapperInside. Note the underscore (probably on the wild side)

Louise

dwight.stegall@gmail.com
Guest
 
Posts: n/a
#6: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


Why use tables at all? It is very easy to simulate a table with divs
and floats like I have here.

http://dwight.tendirect.com/colorsafe.htm

Barbara de Zoete
Guest
 
Posts: n/a
#7: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


On 17 Aug 2005 09:01:13 -0700, <dwight.stegall@gmail.com> wrote:
[color=blue]
> Why use tables at all? It is very easy to simulate a table with divs
> and floats[/color]

Yeah, well, that's all wounderful of course, but the first 'rule' (if one can
use that word) is to use elements to markup content that have some meaning, are
semantic in some way. So using a table (and the related elements) to markup
tabular data is _always_ preferred over using bogus markup withs divs, spans and
styles to emulate a table for tabular data.


--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'

tbcarver@yahoo.com
Guest
 
Posts: n/a
#8: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE



boclair wrote:[color=blue]
> You might add the rule zoom:1 to the class selector wrapperInside, or[/color]

Yes that worked!

boclair wrote:[color=blue]
> you might add the following the non rule _height:1px to the class
> selector wrapperInside. Note the underscore (probably on the wild side)[/color]

Worked also, but very wild side.

tbcarver@yahoo.com
Guest
 
Posts: n/a
#9: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE



Els wrote:[color=blue]
> Please quote what you are replying to? I now had to find out what you
> were on about from previous postings.
> And don't blame it on Google Groups, as you can read here:
> http://www.safalra.com/special/googlegroupsreply/[/color]

Thanks for the tip


Els wrote:[color=blue]
> Just set a height to the inner div (any height, I usually use 1%, but
> you have to hide that style from other browsers), and it conforms to
> what Firefox and Opera do.[/color]

Awesome! This did fix the issue.
http://hughaxton.com/NewsGroups/HeightIE2DivsTable.html

Els wrote:[color=blue]
> Now you'll probably ask why the outer div when it was by itself,
> didn't show the same problem. That's because you set a width on it.
> Either width or height makes the box encompass its contents, whether
> those contents include elements with margins, or even floats. In WinIE
> that is![/color]

This is true for the inner div, but not the outer. The outer always
seems to work even without the height or width. (I added the width to
the sample for easy of use to the reader)
http://hughaxton.com/NewsGroups/IE2DivsTable2.html

Thanks for help.

tbcarver@yahoo.com
Guest
 
Posts: n/a
#10: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE



Barbara de Zoete wrote:[color=blue]
> On 17 Aug 2005 09:01:13 -0700, <dwight.stegall@gmail.com> wrote:
>[color=green]
> > Why use tables at all? It is very easy to simulate a table with divs
> > and floats[/color]
>
> Yeah, well, that's all wounderful of course, but the first 'rule' (if one can
> use that word) is to use elements to markup content that have some meaning, are
> semantic in some way. So using a table (and the related elements) to markup
> tabular data is _always_ preferred over using bogus markup withs divs, spans and
> styles to emulate a table for tabular data.[/color]

Well said. I need the table for tabular data.

Els
Guest
 
Posts: n/a
#11: Aug 17 '05

re: Table Margin Inside Multiple Div Problem on IE


tbcarver@yahoo.com wrote:
[color=blue]
> Els wrote:[color=green]
>> Just set a height to the inner div (any height, I usually use 1%, but
>> you have to hide that style from other browsers), and it conforms to
>> what Firefox and Opera do.[/color]
>
> Awesome! This did fix the issue.
> http://hughaxton.com/NewsGroups/HeightIE2DivsTable.html[/color]

Eh.. not quite :-)

Now the margin-collapsing is in action in Opera :-)
Adding a border to the inner div solves that.

Another thing: you have not hidden the height for the inner div from
other browsers than WinIE. In this particular case it doesn't matter,
but in many other instances it's important that other browsers won't
honour the 1% or 1px height.

You can hide it by adding an underscore to it, like so:

_height:1%; /* the validator doesn't like this hack,
but it is valid CSS2.1 */

or with this hack:

/* hiding from IE Mac \*/
* html .wrapperInside{
height:1%;
}
/* end hide from IE Mac */
[color=blue]
> Els wrote:[color=green]
>> Now you'll probably ask why the outer div when it was by itself,
>> didn't show the same problem. That's because you set a width on it.
>> Either width or height makes the box encompass its contents, whether
>> those contents include elements with margins, or even floats. In WinIE
>> that is![/color]
>
> This is true for the inner div, but not the outer. The outer always
> seems to work even without the height or width. (I added the width to
> the sample for easy of use to the reader)
> http://hughaxton.com/NewsGroups/IE2DivsTable2.html[/color]

I meant when it was the only div. When you take out the inner div from
the HTML, the outer div collapses just the same in IE.

This effect only happens with the div that's the direct parent of a
table. If you'd substitute the table for a div (with the same margin
and border properties), the parent div would not collapse in the
absence of width and height.

Now, why exactly this difference between the parent of a div and the
parent of a table, I don't know :-)
[color=blue]
> Thanks for help.[/color]

You're welcome :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: The Beatles - Lovely Rita
Closed Thread


Similar HTML / CSS bytes