Force absolute div to listen to parent's padding?

css, html

Solution

You can fix the issue using a wrapper

Your HTML will look something along these lines:

<div id="panel">
    <div class="wrapper">
        <div id="bottom">
            <div class="update">
                a          
            </div>
        </div>    
    </div>
</div>

And your 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;
}

Here is a pen with the end result: http://codepen.io/DanielVoogsgerd/pen/Lezjy

Problem

This is what my HTML/CSS currently looks like: Here is what I want it to look like: How can I modify the HTML/CSS below so that it shows how I want it to? 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; } ``` Thanks

Original source