溢出问题:auto;和铬 [英] problem with overflow:auto; and chrome

查看:101
本文介绍了溢出问题:auto;和铬的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种html代码:

I have this kind of html code :

.content { background-color:#3C2B1B; overflow:auto;}
.menu { width:185px; float:left; background-color:#E2DED2; margin-top:10px; margin-left:10px; margin-bottom:10px; padding-left:10px; padding-right:10px;}
.main {width:675px; float:left; margin:10px;}

<div class="content">
    <div class="menu">
        Menu    
    </div>

    <div class="main">    
        Main
    </div>
</div>

它适用于IE和Chrome,但在Chrome上,如果我快速刷新页面,有时

It works nicely on IE and Chrome, but on Chrome, if I refresh the page quickly, sometimes the whole content div go hide.

如果我删除 overflow:auto; 我摆脱这个问题,但当然我失去了背景颜色。

If I remove overflow:auto; I get rid about this problem, but of course I lost the background color.

这是一个常见问题吗?或者是什么?我该如何解决呢?

Is it a common issue? Or what? And how can I fix it?

Chrome版本为8.0.552.237

P.S. Chrome version is 8.0.552.237

推荐答案

.content { background-color:#3C2B1B;}
.menu { width:185px; float:left; background-color:#E2DED2; margin-top:10px; margin-left:10px; margin-bottom:10px; padding-left:10px; padding-right:10px;}
.main {width:675px; float:left; margin:10px;}
.clear {clear:both}

<div class="content">
    <div class="menu">
        Menu    
    </div>

    <div class="main">    
        Main
    </div>
    <div class='clear'></div>
</div>

这是我使用浮动元素时的一个小技巧。添加空div和清除两个css将保持.content div从崩溃

This is a little trick i use when working with floating elements. adding the empty div with the clear both css will keep the .content div from collapsing

我希望它适用于你:)

这篇关于溢出问题:auto;和铬的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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