Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I'm facing a problem. See my code below, I don't understand why the table is not getting centrally alligned on the browser.

<table border="0" cellpadding="1" cellspacing="0" width="470" bgcolor="CDCDCD">
<tr align="center"><td align="center">
<table border="0" cellpadding="2" cellspacing="0" width="100%" bgcolor="EEEEEE">
<tr bgcolor="CDCDCD"><td> Select Region</td>
<td align="RIGHT">
</td></tr>  
<tr bgcolor="FFFFFF"><td colspan="2"</td></tr>
<tr bgcolor="FFFFFF"><td align="CENTER"> 
<asp:RadioButtonList ID="rbRegion" runat="server" Font-Size="X-Small" 
        RepeatDirection="Horizontal" Width="124px" OnSelectedIndexChanged ="rbRegion_Click" AutoPostBack="true"> 
      <asp:ListItem Value="1">US
      <asp:ListItem Value="2">CAN

</td><td></td></tr>
<tr bgcolor="FFFFFF"><td colspan="2"</td></tr> 
 </table>
</td></tr>
</table>


If you have any idea pls help me. Thanks in advance.

Regards,
Subhadeep
Posted

Add style="margin:auto;" to your Main Table as below.
HTML
<table border="0" cellpadding="1" cellspacing="0" width="470" bgcolor="CDCDCD" style="margin:auto;"></table>

However I do not recommend you Table based HTML design considering below aspects.

1) W3C Standards
http://www.w3.org/standards/webdesign/htmlcss

2) Cross Browser Compatibility.
http://en.wikipedia.org/wiki/Cross-browser

Instead use "Div" based design layout.
http://www.w3schools.com/tags/tag_div.asp
 
Share this answer
 
use this in the tag it may help you :)

<table align="center"></table>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900