473,396 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Table Margin Inside Multiple Div Problem on IE

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

Aug 17 '05 #1
10 6243
give div2 a border or padding

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

Aug 17 '05 #2
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

Aug 17 '05 #3
Els
tb******@yahoo.com wrote:
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


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 -
Aug 17 '05 #4
tb******@yahoo.com wrote:
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


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

Aug 17 '05 #5
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

Aug 17 '05 #6
On 17 Aug 2005 09:01:13 -0700, <dw************@gmail.com> wrote:
Why use tables at all? It is very easy to simulate a table with divs
and floats


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 |
`-------------------------------------------------- --<--@ ------------'

Aug 17 '05 #7

Els wrote:
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/
Thanks for the tip
Els wrote: 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.
Awesome! This did fix the issue.
http://hughaxton.com/NewsGroups/HeightIE2DivsTable.html

Els wrote: 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!


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.

Aug 17 '05 #8

boclair wrote:
You might add the rule zoom:1 to the class selector wrapperInside, or
Yes that worked!

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


Worked also, but very wild side.

Aug 17 '05 #9

Barbara de Zoete wrote:
On 17 Aug 2005 09:01:13 -0700, <dw************@gmail.com> wrote:
Why use tables at all? It is very easy to simulate a table with divs
and floats


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.


Well said. I need the table for tabular data.

Aug 17 '05 #10
Els
tb******@yahoo.com wrote:
Els wrote:
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.
Awesome! This did fix the issue.
http://hughaxton.com/NewsGroups/HeightIE2DivsTable.html


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 */
Els wrote:
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!
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


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 :-)
Thanks for help.


You're welcome :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: The Beatles - Lovely Rita
Aug 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jukka K. Korpela | last post by:
I just noticed that most browsers render <table border="1"><tr><td><p>foo</p></td></tr></table> the same way as <table border="1"><tr><td>foo</td></tr></table> That is, they ignore the p...
7
by: Bob Bedford | last post by:
I've an image in a cell of a table. I've this CSS: ..dbtable{ width: 600px; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; border-collapse: collapse; border: 1px solid #000000;
4
by: N. Demos | last post by:
The following code renders as intended in IE (A TABLE, with cells of fixed width and height, inside of a DIV with fixed width and height and overflow set to hidden.) In Firefox, the table cells...
3
by: N. Demos | last post by:
I have a single row table with fixed dimensioned cells nested inside a fixed dimensioned div, which has overflow: hidden. The div's dimensions are such that It should only display the first two...
117
by: phil-news-nospam | last post by:
Is there really any advantage to using DIV elements with float style properies, vs. the old method of TABLE and TR and TD? I'm finding that by using DIV, it still involves the same number of...
5
by: outstretchedarm | last post by:
I'm extremely new to javascript and to programming in general. I am trying to create an interactive table. I have already created the table with constants, in the key of C (it is for music). ...
7
by: Johnny | last post by:
In MSIE table captions are displayed at the same size as content. But in Firefox the text displays at browser default, It also exceeds the width of the table and the excess is hidden if the table...
1
by: rsteph | last post by:
I've got a page with a menu div that is 1066px wide by 150px high. And then I have some images that are 150px by 150px for the menu items. I put the images in a table that is set to 150x150px with a...
13
by: ed08857 | last post by:
Hello, I have a table that I use to display data. When the the page is displayed in FF, table elements appear the same size as the text outside of the table, and that's what I want. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.