我在使用Bootstrap 3时控件显示远远少于100%的问题,这是一个示例:

html - 自举输入控件的宽度太短-LMLPHP

如您所见,除Tag控件外,所有控件都比其容器短得多。将标记设为令牌字段后,标记开始以完整长度显示。生成此代码的代码是:

<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading clearfix">
                <b class="panel-title">Information</b>
                <a href="#" data-toggle="collapse" data-target="#Information" style="color: black;"><span id="InfoCollapseIcon"></span></a>
            </div>
            <div class="panel-body panel-collapse collapse in" id="Information">
                <div class="form-group">
                    @Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label text-left col-md-4" })
                    <div class="col-md-8">
                        @Html.TextBoxFor(model => model.Name, htmlAttributes: new { @class = "form-control", @title = "The unique name of the generator." })
                        @Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
                    </div>
                </div>

                <!-- Rinse and Repeat the above -->
            </div>
        </div>
    </div>
</div>


如何使控件填充其容器的宽度?

最佳答案

如果从模板生成项目,请在Content/Site.css中检查此规则

/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
    max-width: 280px;
}

关于html - 自举输入控件的宽度太短,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43094856/

10-11 23:58
查看更多