IE8 CSS 浮动问题
我确信这之前一定已经涵盖过,因为我确信我不是第一个这样做的人,但我找不到答案。我正在使用重复的背景图像为
创建阴影效果。在底部的两个角,我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在浏览您的页面时,我发现它默认进入怪异模式,这是可能的问题,因为如果我强制它进入严格模式,它似乎可以解决所有 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!
我认为这与浮动元素超出了 div 的边界有关,请尝试在关闭父 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: