8

这是我的 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;
}

谢谢

4

2 回答 2

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

于 2013-07-29T11:57:01.143 回答
0

在 CSS 中

* {
    box-sizing: border-box;
}
于 2017-01-27T07:48:53.473 回答