如何在形式中居中一个div [英] How to center one div in form

查看:152
本文介绍了如何在形式中居中一个div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#Asp.net上工作

I work on C# Asp.net

主div
----表

Main div ---- table

想要在form.i的中间显示这个div想要建立一个登录form.my表包含

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>

想在表单的中间显示div?以及为什么我的标签文本会破解如何解决它?

如果u去google.com比你看到文本框在中间位置

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?

推荐答案

您可以使用此方法在表单中间显示id: -

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>

这篇关于如何在形式中居中一个div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆