开发者

problem with overflow:auto; and chrome

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; marg开发者_运维百科in:10px;}

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

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

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

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?

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>

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

I hope it works for you :)


by setting css for div inner elements as

display:inline

i resolved this

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜