Lets say you have some dynamic content that you need to center. For example a few buttons:
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
and lets say in some cases you show btnSave in some cases not.
So ideally you want to use div and margin auto for centering:
<div style="margin:0 auto;width:200px;">
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
</div>
But, you don't know exact width, since number of buttons is variable. Of course you can make width
dynamic in code behind. However sometimes width is difficult to calculate, so you need better solution.
Table is a saver:
<table align="center">
<tr>
<td>
<asp:Button ID="btnBack" runat="server" Text="Back" />
<asp:Button ID="btnSave" runat="server" Text="Save" />
<asp:Button ID="btnNext" runat="server" Text="Next" />
</td>
</tr>
</table>