开发者

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

开发者_如何学Python
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?


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>


You've edited your question now so this doesn't give you the exact code you need, but would help you work it out / others who view your question with a similar problem. So here goes... you need something like this:

<style type="text/css">
    .wrp { width: 100%; text-align: center; }
    .frm { text-align: left; width: 500px; margin: auto; border: 1px solid black; }
    .fldLbl { white-space: nowrap; }
</style>

<div class="wrp">
    <div class="frm">
        <span class="fldLbl">User name:</span>
    </div>
</div>


try this option, that is style the div with style="width:100%;text-align:center"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜