Maybe you want as this: Demo
HTML
<div id="main_content">
<div id="container">vertical aligned text<br />some more text here
</div>
</div>
CSS
#main_content {
width: 500px;
height: 500px;
background: #2185C5;
display: table-cell;
text-align: center;
vertical-align: middle;
}
#container{
width: auto;
height: auto;
background: white;
display: inline-block;
padding: 10px;
}
How?
In a table cell, vertical align with middle will set to vertically centered to the element and text-align: center;
works as horizontal alignment to the element.
Noticed why is #container is in inline-block because this is in the condition of the row.