CSS: height:100% vs bottom:0
css
Solution
The height of the child element is determined differently for each property:
`bottom: 0` => child_height = parent_height - child_margin - child_border
`height: 100%`=> child_height = parent_height
In other words `height: 100%` sets the inner height of the child to the same height of its parent, while `bottom: 0` sets the outer height of the child to the same height of its parent.
Example from https://jsfiddle.net/2N4QJ/1/
.parent {
width: 100px;
height: 300px;
position: relative;
background: #ccc;
display: block;
float: left;
padding: 10px;
margin: 20px
}
.parent > div {
display: block;
margin: 10px;
background: red;
position: absolute;
color: white !important;
}
#c1 {
top: 0;
background-color: green;
height: 100%;
}
#c2 {
top: 0;
background-color: blue;
bottom: 0;
}
<div class="parent">
<div id="c1">height: 100%, margin: 10px</div>
</div>
<div class="parent">
<div id="c2">bottom: 0, margin: 10px</div>
</div>
More info about position/dimension: http://msdn.microsoft.com/en-us/library/ms530302(VS.85).aspx (archive link)
Problem
What is the essential difference between: ``` position: absolute; top: 0; height: 100%; ``` and ``` position: absolute; top: 0; bottom: 0; ```