IE8 CSS 浮动问题

发布于 2024-08-03 22:26:07 字数 450 浏览 0 评论 0原文

我确信这之前一定已经涵盖过,因为我确信我不是第一个这样做的人,但我找不到答案。我正在使用重复的背景图像为

创建阴影效果。在底部的两个角,我使用 9x5 像素的小图像。我将它们左右浮动,在 Firefox 和 Safari 中它们看起来很完美。在 IE8(可能还有其他 IE)中,它们向左和向右浮动太远,大约 3px。

您可以在此处查看该问题。这是我妻子的 eBay 模板。

到目前为止,我已经尝试设置 display:inline 来修复类似的 IE6 问题。我还尝试将图像边距和填充设置为 0px,但没有成功。

有什么想法吗?

谢谢, 卡莱格

I'm sure this must have been covered before because I'm sure I'm not the first to do this, but I can't find the answer. I am creating a shadow effect for a <div> using repeated background images. In the bottom two corners I use small 9x5 px images. I float them left and right and in Firefox and Safari they look perfect. In IE8 (and possibly other IEs) they float too far to the left and right about about 3px.

You can see the issue at here. It's an ebay template for my wife.

Thus far I've tried setting display:inline which was a fix for a similar IE6 issues. I also tried setting image margins and padding to 0px with no luck.

Any ideas?

Thanks,
Carraig

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

女皇必胜 2024-08-10 22:26:07

在浏览您的页面时,我发现它默认进入怪异模式,这是可能的问题,因为如果我强制它进入严格模式,它似乎可以解决所有 IE 情况下的浮动问题。

在这里阅读 ppk 的文章:
http://www.quirksmode.org/css/quirksmode.html

他解释了原因它的发生以及如何解决它:)

希望它有帮助!

Whilst browsing your page I found that it is defaulting into quirks mode, which is the probable issue, because if I force it into Strict it seems to fix your floating problem in all cases of IE.

have a read of ppk's article here:
http://www.quirksmode.org/css/quirksmode.html

he explains why its happening and how to fix it :)

Hope it helps!

一袭白衣梦中忆 2024-08-10 22:26:07

我认为这与浮动元素超出了 div 的边界有关,请尝试在关闭父 div 之前插入它:

<div style="clear: both; font-size: 1px; line-height: 0px;">  </div>

I think it has something to do with the float elements getting outside the borders of the div, try inserting this before you close the parent div:

<div style="clear: both; font-size: 1px; line-height: 0px;">  </div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文