基于Identity提供的登录页面修改的显示左右垂直居中效果

Identity提供的登录页面只能说能用而已,想要漂亮一点,只能进行修改。我们需要左右垂直居中效果,同时加一个有颜色的边框,排列更符合中国人的审美习惯,具体代码如下:

@page
@model LoginModel

@{
    ViewData["Title"] = "账户登录";
}

<style>
    .top {
        margin-top:150px;
    }
    .bd {
        border-style: solid;
        border-width: medium;
        border-color: #98bf21;
    }
</style>
<div class="top">
    <div class="row" >
        <div class="col-md-4"></div>
        <div class="col-md-4 bd">
            <section>
                <form id="account" method="post">
                    <h3 class="text-center">@ViewData["Title"]</h3>
                    <hr />
                    <div asp-validation-summary="All" class="text-danger"></div>
                    <div class="form-group form-inline justify-content-center">
                        <label asp-for="Input.UserName"></label>
                        <input asp-for="Input.UserName" class="form-control" />
                        @*<span asp-validation-for="Input.UserName" class="text-danger"></span>*@
                    </div>
                    <div class="form-group form-inline justify-content-center">
                        <label asp-for="Input.Password"></label>
                        <input asp-for="Input.Password" class="form-control" />
                        @*<span asp-validation-for="Input.Password" class="text-danger"></span>*@
                    </div>
                    <div class="form-group form-inline justify-content-around">
                        <button type="submit" class="btn btn-primary w-50">登录</button>
                        <p>
                            <a id="forgot-password" asp-page="./ForgotPassword">忘记密码?</a>
                        </p>
                    </div>
                </form>
            </section>
        </div>
        @*<div class="col-md-4"></div>*@
    </div>
</div>

说明:左右居中的实现思路是根据col-md-4把页面三等分,前面加一个空白的,第二个则是居中的,第三个可以省略,同时使用justify-content属性。然后是垂直居中效果并不好,所以想了简单办法使用margin-top来上面留空。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

落单枫叶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值