Forum Moderators: phranque
I have a general question. I want to make sure all my pages displaying in the center position of browser, no matter what kind of browser, what the size of the openning browser or what resolution the monitor setting.
I think it can be done in the HTML code. But I am not sure how to do it. Any suggestion is highly appreciated.
<style>
table { height:100%; width:100%; }
tr.valign { vertical-align:center; }
tr.valign td { text-align:center; }
</style>
<table>
<tr class="valign">
<td>absolutely centered</td>
</tr>
</table>
The 'correct' way to center a div is to specify 'auto' for its left and right margins.
div#centered {
margin: 0 auto;
}
text-align: center on the parent element.