这就是我的HTML / CSS 目前的样子:
以下是我想要的样子:
如何修改下面的HTML / CSS,以便显示我想要的内容?
HTML:
<div id="panel">
<div id="bottom">
<div class="update"></div>
</div>
</div>
CSS:
.update {
width: 100%;
background-color: #006699;
text-align: center;
height: 56px;
color: white;
}
#bottom {
position: absolute;
bottom: 20px;
width: 100%;
left: 0;
}
#panel {
width: 21.25%;
height: 100%;
background-color: #0794ea;
float: left;
padding: 0 1.5%;
-moz-box-sizing: border-box;
box-sizing: border-box;
position: relative;
}
由于
答案 0 :(得分:10)
您可以使用包装器解决问题
您的HTML将看起来像这样:
<div id="panel">
<div class="wrapper">
<div id="bottom">
<div class="update">
a
</div>
</div>
</div>
</div>
你的CSS:
#panel {
width: 21.25%;
height: 100%;
background-color: #0794ea;
float: left;
padding: 0 1.5%;
box-sizing: border-box;
}
.update {
width: 100%;
background-color: #006699;
text-align: center;
height: 56px;
color: white;
}
.wrapper {
position: relative;
height: 100%;
}
#bottom {
position: absolute;
bottom: 20px;
left: 0;
width: 100%;
background: yellow;
}
这是一支带有最终结果的笔:http://codepen.io/DanielVoogsgerd/pen/Lezjy
答案 1 :(得分:0)
在css中
* {
box-sizing: border-box;
}