Grady_1234
Grady_1234
采纳率90.9%
2019-11-21 10:19

asp.net做的登陆界面如何居中?

asp.net做的登陆界面如何居中,下面是源代码,如何修改

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>游戏库</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        用户名:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
        <br />
        密&nbsp; &nbsp;码:<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox><br />
        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <br />
        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="登录" OnClick="Button1_Click" />
        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
        <asp:Button ID="Button2" runat="server" Text="注册" OnClick="Button2_Click" style="height: 21px" /></div>
    </form>
</body>
</html>

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • hjs218 Json-Huang 2年前

    最简单的方法可以在div中加上align="center"试试

    <div align="center">
    
    点赞 评论 复制链接分享
  • Lsaacs Best World 2年前
     第一种:
     <center>
    <body>
    ......
    </body>
    </center>
    
    第二种:
    
    <style>
    div{
    margin:0 auto;
    }
    </style>
    
    点赞 1 评论 复制链接分享