Internet Explorer Ignores Bottom Margin

Well, I noticed something strange today that I had not noticed before. Internet Explorer ignores the bottom margin I had set when it is the last item on the page. I had the same problem in IE 6 and 7, but not in Firefox or Safari.

To elaborate, I set a bottom margin on the last element on the page. IE ignored it and displayed the element flush with the bottom of the browser instead of showing a margin. When I added another item below it, it showed the margin, so it has something to do with being the last item on the page. This only happened in IE 6 and 7.

Solutions I thought of included setting a transparent border, increasing the height of the footer and setting padding on the body. The transparent border didn’t work in Firefox or IE. Increasing the height of the footer wouldn’t work because there was a bottom aligned background that needed to appear at a certain height. I felt that setting padding for the body was also not a good practice.

I tried everything I could think of to get around it. I ended up adding an empty div below the element and setting the height to what I wanted the margin to be. This worked. It was the best solution because all of the other things I could think of wouldn’t work because of the design constraints.

Related Posts:

del.icio.us Digg Furl Reddit Google StumbleUpon Technorati Yahoo!

2 Responses to “Internet Explorer Ignores Bottom Margin”

  1. Sherwin Techico Says:

    Hey Jonathan. I was just searching when I happened to find your entry on down the list or results. I just ended up adding a padding (margin would do too) on the body. This worked for me as I have a div#container inside my body-tag which surround the #header, #content, and #footer sections of the page. So yeah–I hope this helps as another solution.

  2. dross Says:

    Try just using padding instead of margin on that one element.

Leave a Reply

Most Popular Posts

Pages

Twitter Updates

  • And yes it is true for those of you that don't know, the bird is the word. Indeed. 1 day ago
  • Excellent Office Space reference in Family Guy this week. Slow motion too. 1 day ago
  • Feeling like Michael Scott is going to walk by my desk at any moment. 1 day ago
  • More updates...

Profiles