gpt4 book ai didi

css - Asp.Net MVC 5 + Bootstrap 。如何使输入适合屏幕宽度?

转载 作者:行者123 更新时间:2023-12-04 16:34:48 26 4
gpt4 key购买 nike

我真的不知道我做错了什么。我希望我的文本框与下面的按钮大小相同。我已经尝试在 cshtml 中进行很多更改,但没有成功。

enter image description here

在我的 cshtml 文件下面:

@model SomeModel.Models.LoginViewModel

<div class="row">
<div class="col-md-8 col-sm-12 col-xs-12">
<section id="loginForm">
@using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<hr />
@Html.ValidationSummary(true)
<div class="form-group">
@Html.LabelFor(m => m.UserName, new { @class = "col-md-2 control-label" })
<div class="col-md-12">
@Html.TextBoxFor(m => m.UserName, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.UserName)
</div>
</div>
<div class="form-group">
@Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
<div class="col-md-12">
@Html.PasswordFor(m => m.Password, new { @class = "form-control" })
@Html.ValidationMessageFor(m => m.Password)
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-xs-12">
<button type="submit" class="btn btn-success btn-block">Entrar</button>
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-sm-12 col-xs-12 visible-sm visible-xs">
<button type="submit" class="btn btn-primary btn-block">Ainda Não Tenho Conta</button>
</div>
</div>
<div class="form-group">
<div class="col-md-10 col-sm-12 col-xs-12 visible-sm visible-xs">
<button type="submit" class="btn btn-info btn-block">Esqueci Meu Usuário Ou Senha</button>
</div>
</div>
<p>
@Html.ActionLink("Register", "Register") if you don't have a local account.
</p>
}
</section>
</div>
</div>
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}

我做错了什么?

最佳答案

默认的 MVC5 模板在 Site.css 中有一个 css 规则:

input, select, textarea { max-width: 280px; }

我通常会删除这条规则。

它会导致 Bootstrap v3 输入组出现问题,其中输入框未扩展到其容器的宽度。

关于css - Asp.Net MVC 5 + Bootstrap 。如何使输入适合屏幕宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30958361/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com