Forum Moderators: not2easy
Something tells me the answer to my problem is an easy one, but every time I fiddle with it and get it right in one browser, it breaks in another.
I'm talking about 100% wide tables within a DIV tag.
The bulk of my page is enclosed in a DIV with a 1px border and 10px padding. Inside that goes most of the information. The only other information on the site is a header with our logo and a menu above the DIV tag. I have tables inside the DIV on most of my pages, but they exhibit odd behavior when browsing with Firefox.
I'm sad to say, when I originally designed the site, I did it around Internet Explorer 6. It's an intranet site used by 15 people and getting them to switch to Firefox (my preferred browser) isn't very easy, so I had to make it look good when they browsed it.
The code looks like this:
#body
{
width: 100%;
padding: 10px;
border: 1px solid black;
}
<div id="body">
<table width="100%">
-- table data here --
</table>
</div>
If I take out the padding field, they both look fine (albeit with no space between the border on the DIV and the content within it). I'd like to keep the DIV in there to break up the page into sections, because a free-flowing layout (i.e., a layout without a bounding box) just doesn't look good with what I'm doing.
I've tried to take out the padding on the DIV and put it on the table, and once again, Firefox handles it fine, but IE completely ignores the padding and keeps the table's edges flush against the DIV's.
I'm sure there's something really simple I'm missing here. It's one of those things where I've tried a million different combinations of things but it's the one I haven't tried that's going to work out for me.
Sorry for the long-winded post; it's been bugging me for a while now.
margin-bottom: 1em, Firefox does not, so my header DIV is stuck to the body DIV. Putting margin-top: 1em on the body DIV seemed to give me the gap I wanted, but I wonder if there's a good reason why having a top margin on the bottom DIV works and a bottom margin on the top DIV does not. Thanks for your help.
Also, with absolute positioning, the body DIV overlaps everything under it, and no amount of clearing seems to fix that.