有人可以向我解释为什么我的文本框没有拉伸?我花了很多时间在这上面,我显然错过了一些东西。
我在SO和其他网站上看过各种答案,但无济于事。我尝试使用style
更改属性,但再次没有运气!
我发现了一篇关于SO的文章,但现在找不到它,但我确实有提供的示例:resize example并且文章声明您可以简单地设置width:100%
样式,但即使看这个例子也让我疯狂,因为两条线都拉伸了100%,但只有一条线宽度设定为100%
@using System
@model MyCompany.Models.ApplicationFormModel
@{
ViewBag.Title = "Application Form";
}
@*<h2>ApplicationForm</h2>*@
<div class="row">
@*<div class="col-sm-6">*@
<div class="well bs-component">
@using (Html.BeginForm("ApplicationForm", "Registration",
FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
<fieldset>
<legend>Application Form</legend>
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Name,
new { @class = "control-label col-sm-2" })
<div class="col-sm-10">
@Html.TextBoxFor(model => model.Name,
new { @class = "form-control", style = "width:100%" })
@Html.ValidationMessageFor(model => model.Name, "",
new { @class = "text-danger" })
</div>
</div>
<div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-primary" />
</div>
</div>
</div>
</fieldset>
}
</div>
@*</div>*@
</div>
答案 0 :(得分:1)
查看Site.css
你可能会找到下一行
/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
max-width: 280px;
}