so I have a div which is min-height 100%; (100% of the screen or more). The child holds the content and needs to be centered vertically, but it might extend the parent to more t
Use the display: table;
and display: table-cell;
properties.
The outer DIV will need to have display: table;
and the inner DIV display: table-cell;
along with vertical-align: middle;
. Now you will be mimicing the default display of a td
.
CSS
.parent {
min-height: 100%;
display: table;
}
.child {
display: table-cell;
vertical-align: middle;
}
HTML
<div class="parent">
<div class="child">child</div>
</div>
This question has been asked often. A simple search here on SO or Google will get you plenting of results.