I have the following div with list content. How to center it on an HTML page relative taking the size of the content of the div into consideration?
HTML
<div id="container">
<dl>
<dt>Item 1</dt>
<dt>Item 2</dt>
<dt>Item 3</dt>
<dt>Item 4</dt>
</dl>
</div>
I have the following css which works fine to position the div horizontally but it doesn't work for vertical center position:
div {
position: absolute;
text-align: center;
width: 50%;
left: 25%;
top: 50%;
border-width: 4px;
border-style: groove;
vertical-align: middle;
}