I would like my absolutely positioned element to:
The container div has a %
based width.
You can see my problem here: http://jsfiddle.net/vTuTv/2/
.container {
min-height: 200px;
width: 50%;
background-color: #3e3e00;
position: relative;
padding-left: 15px;
padding-right: 15px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.line {
background-color: #003e3e;
position: absolute;
bottom: 0;
height: 22px;
width: 100%;
}
<div class="container">
<div class="line"></div>
</div>
Obviously if the element wasn't absolutely positioned then I could just use box-sizing
on the parent element.
Don't use width: 100%
for that. The following code does the work.
.line {
position: absolute;
bottom: 0;
height: 22px;
left: 15px;
right: 15px;
}