align table in center of page using html

Posted by Klbaiju under Others on 8/7/2010 | Views : 18349 | Status : [Member] | Replies : 7
Hi,
i want to display a table on the middle of a page.

this is my coding
<table>
<tr><td>Username</td><td><asp:textBox id="txtuname" runat="Server"/></td></tr>
<tr><td>Password</td><td><asp:textBox id="txtpassword" runat="Server"/></td></tr>
<tr><td><asp:Button Id="Btn1" runat="Server"/></td></tr>
</table>
the table should be same distance from left,right,top,bottom

Regards
K L BAIJU




Responses

Posted by: Vanchi050585 on: 8/7/2010 [Member] Starter

Up
0
Down
hi ,
do it
Dont forket to mark as answer
<table align="center">
<tr><td>Username</td><td><asp:textBox id="txtuname" runat="Server"/></td></tr>
<tr><td>Password</td><td><asp:textBox id="txtpassword" runat="Server"/></td></tr>
<tr><td><asp:Button Id="Btn1" runat="Server"/></td></tr>
</table>

it will work very well

Dont forket to mark as answer
Thanks

Thanks
tvn

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Klbaiju on: 8/7/2010 [Member] Starter

Up
0
Down
i know this this align only on top center.i need the table on
center of page. means same distance from left,right,top,bottom

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neeks on: 8/7/2010 [Member] Bronze

Up
0
Down
Please insert the table in DIV and set the margin for DIV.
and in you set the align property of the table it will change all the controls and text's property to center

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shankul2784 on: 8/8/2010 [Member] Bronze

Up
0
Down


Hi,
try this,

<table align="center" width="100%">

Thanks & Regards,

Shailesh

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shankul2784 on: 8/9/2010 [Member] Bronze

Up
0
Down


Hi,
try this,

If not working previous one then it will work with following -

<table align="center" width="100%">
<tr>
<td align="center">
<table>
//your code
</table>
</td>
</tr>
</table>



Thanks & Regards,

Shailesh

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sundermagar on: 8/9/2010 [Member] Starter

Up
0
Down
I think you are looking for this...

<div style="width: 100%; border: solid 1px #000000;">
<table style="margin: auto;">
<tr>
<td>
Center Aligned Table
</td>
</tr>
</table>
</div>


Thanks,


Sunder Magar

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 8/9/2010 [Member] Bronze

Up
0
Down

<center>
<table>
<tr><td>Username</td><td><asp:textBox id="txtuname" runat="Server"/></td></tr>
<tr><td>Password</td><td><asp:textBox id="txtpassword" runat="Server"/></td></tr>
<tr><td><asp:Button Id="Btn1" runat="Server"/></td></tr>
</table>
</center>

u can also use center tag to align ur table in the center of the page

Thanks
Pavan Kumar
Mark Answer if this fits the need

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response