浮动DIV右边会导致元素在IE7中换行 [英] Floating a DIV right causes elements to wrap in IE7

查看:195
本文介绍了浮动DIV右边会导致元素在IE7中换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,浮动一个容器在右边的IE7。一切在IE8 +,Firefox,Chrome和Safari看起来不错,但是容器中的元素在IE7中出于某种原因包装。

I'm having a problem with floating a container to the right in IE7. Everything looks fine in IE8+, Firefox, Chrome, and Safari but the elements within the container wrap for some reason in IE7.

我已经设置了一个小调href =http://jsfiddle.net/aagC9/ =nofollow> http://jsfiddle.net/aagC9/ 。我看到的问题是在IE9浏览器模式/文档模式中发现的IE7(它也是在XP的IE7,但我认为这将是更容易为人们签出)。

I've set up a fiddle at http://jsfiddle.net/aagC9/. The problem I'm seeing is visible in the IE7 Browser Mode/Document Mode found in IE9 (it's also in IE7 on XP but I figured this would be easier for people to check out).

虽然看起来很多人遇到类似的问题,他们的解决方案并没有为我工作。我试过添加 overflow:hidden overflow:visible 到容器和元素的各种组合。我也尝试在 .message 容器上设置固定宽度,但是似乎没有任何效果。虽然我可以在 .message 上使用固定的左边距,但它不工作100%,因为IE7不支持box-sizing模型。

While it seems like many people have run into similar problems, their solutions haven't worked for me. I've tried adding overflow: hidden and overflow: visible to both the container and elements in various combinations. I also tried setting a fixed width on the .message container, but that didn't seem to have any effect either. While I could just use a fixed left margin on .message, it doesn't work 100% since the IE7 doesn't support the box-sizing model.

有没有人知道在IE7中使用浮动工作的秘密?

Does anybody know the secret to getting this to work in IE7 with the float?

谢谢!

推荐答案

它与你对 display:inline-block; 的依赖有关,IE7 支持,只是不是总能正确 。实际上,修复它是相当严重的。但是,在这个更新的小提琴,它的工作原理。

It has to do with your reliance on display:inline-block; which IE7 supports, just not always correctly. Actually, fix for it is pretty gross. But, as in this updated fiddle, it works.

这篇关于浮动DIV右边会导致元素在IE7中换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆