html - 简单的水平等分

标签 html css

好的,我正在设置一个迷你页面,我希望它是 100% 可扩展的,所以我尝试只使用 %。

但我没有让“元素”占据 33% 的宽度,并且分布超过了“内容”的 80%。

我做错了什么?

body, html{
    width: 100%;
    height: 100%;
}

.menu{
    width: 20%;
    height: 100%;
    background: #fff;
    float: left;
}

.content{
    width: 80%;
    height: 100%;
    background: #eee;
    float: left;
}

.bottom{
    position: absolute;
    bottom: 0;
}

.item{
    width: 33%;
    float: left;
}

.red{background: red;}
.blue{background: blue;}
.green{background: green;}
<div class="menu">menu</div>
<div class="content">content
    <div class="bottom">
        <div class="item red">left</div>
        <div class="item blue">mid</div>
        <div class="item green">right</div>
    </div>
</div>

最佳答案

像这样尝试: Demo

.content{       
    position: relative; 
}

.bottom{       
    width:100%;
}

.item{       
    box-sizing:border-box;
}

关于html - 简单的水平等分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29010779/

相关文章:

java - 禁用表结构

css - 溢出属性在引导卡列中无法按预期工作,需要建议

html - 是否可以在第一个和最后一个元素上放置圆 Angular ?

CSS 问题 : why the 100% width plus 1px border fall in FF browser but not in Chrome?

html - Flexbox/CSS/响应式网页设计图像

html - 中心 Bootstrap 按钮

html - 如何使用粘性页脚 CSS?

javascript - 如何在按钮中使用 (a href ="#")

html - Bootstrap 布局 : getting two scrollbars

html - 如何将图像添加到 HTML 输入小部件?