IE6 extra padding on bottom

≯℡__Kan透↙ 提交于 2019-12-01 19:19:06

Is there an image in your div? If there's an image, there's a bug in IE 6 that can cause white space within the div to create extra padding on the bottom

Extra padding shows up with

<div>
<img src="myimage.jpg">
</div>

Extra padding doesn't show up when you change your HTML to

<div><img src="myimage.jpg"></div>

I would highly recommend taking a look at the positioniseverything.net site and its coverage of IE issues and workarounds. Take a look at the holly hack section - I believe you will find the answer there.

[edit - added] take a look here for the 3px issue, explanation and fix

For box settings and browser difference, sitepoints box model article offers some good insight as well.

Have you tried hiding your DIV overflow? overflow:hidden;

Edit: You may also try display: inline; if you're talking about horizontal pushing.

Make sure font size is not creating the problem. Even with no text inside a container element (say for a bottom cap on a stretchable container) IE6 will still size the height of the box no smaller than the font size (even with an explicit height set.)

So, for example, if you have the HTML:

<div class="box">  
  <h1>Heading</h1>  
  <p>This is the main content.</p>  
  <div class="bottom"></div>  
</div>

...you will need this CSS:

<style type="text/css">
  .box {
    background: url(bg-middle.jpg) repeat-y;
  }
  .box h1 {
    background: url(bg-top.jpg) no-repeat;
  }
  .box .bottom {
    background: url(bg-image.jpg) no-repeat;  /* bottom cap image */
    height: 10px;                             /* height of your bg image */
    font-size: 1px;                           /* for IE6 */
  }
</style>

potentially 'margin' or 'border' properties?

You can also look at something like a CSS reset style sheet which will let you set up defaults which should be reasonably consistent across browsers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!