Search code examples
asp.netcssstylesheet

How to center one div in form


I work on C# Asp.net

Main div ---- table

want to show this div on middle of the form.i want to build a login form.my table contain

User name:**(it's a lable,on browser it's broken like user
                                                       name : show why?)**
password:

<div id="main">

<table width="600px" border="1">
            <tr>
                <td>
<asp:Label ID="Label1" runat="server" CssClass="cssLabel" Text="User Name :"></asp:Label>
                </td>


                <td>
 <asp:Label ID="Label2" runat="server" CssClass="cssLabel" Text="Password :"></asp:Label>
                </td>
            </tr>
        </table>

</div>

want to show div on middle of the form? and why my lable text are going to broken how to solve it?

if u gone to google.com than you see text box take position on middle of the frame.i want this .i want my controls also take position on the middle of the frame.How to do that?


Solution

  • You can use this to show idiv n the middle of the form:-

    <div style="margin-left:auto;margin-right:auto;">Put the controls here </div>