html - 如何在右侧 float 的 div 下添加一个 div?

标签 html css

HTML

<div class="container">
    <div class="left">
        <div class="panel">My Panel</div>
    </div>
    <div class="right"></div>
</div>

CSS

.container {
    background-color: #000;
    margin: 130px auto;
    min-height: 320px;
    width: 940px;
    overflow: auto;
    padding: 0px 10px;
 }

.left {
    width: 600px;
    margin-right: 20px;
    float: left;
 }

.right {
    width: 320px;
    height: 100% auto; 
    overflow: auto;
    background-color: blue;
    float: right;
}

.panel {
    background-color: red;
}

问题:

如何添加另一个可以放在 div.right 下的 div?我想放在 .right 下的 div 将是 .under_right CSS 是:

.under_right {
    width: 320px;
    height: 100% auto; 
    overflow: auto;
    background-color: gold;
}

最佳答案

http://jsfiddle.net/daQ22/2/

添加:

clear:both;
float:right;

到under_right

关于html - 如何在右侧 float 的 div 下添加一个 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16654368/

相关文章:

javascript - 表 td 内的 json2htmled jQuery 移动按钮看起来很旧,在按钮()/刷新后新按钮中有旧按钮

javascript - 同级 div 的替代背景色

javascript - 如何让我的下一个按钮提交表单?

css - 在网站上托管时未显示 Div

html - 为什么我的下拉列表不起作用?

javascript - 单击条形图标以外的任何地方时,垂直导航栏应该折叠

html - 在之后添加带有伪元素的 'before'

html - 为什么这个链接没有得到文本对齐 :right?

html - 将 h2 相对于父容器居中

javascript - 如何将json数据动态插入到html元素中