如何将 MVC 中的文本框布局显示为文本框而无需在侧面下拉?

How to show the Text box layout in MVC as text box without having drop down in the side?

如何在 MVC 中将文本框布局显示为文本框而不在侧面显示下拉菜单?

在附带的屏幕截图中,我们有下拉布局。必须是纯文本框。

<div class="form-group">
                        <div class="col-sm-5 control-label">
                            <label class="hthin">ExceriseTimes</label>
                        </div>
                        <div class="col-sm-1">
                            <textarea id="ExceriseTimes" asp-for="ExceriseTimes" style="height:25px;" class="form-control" type="text"></textarea>
                        </div>
                    </div>

<textarea> 表单元素没有 type 属性,它属于 <input>。如果你想要一个普通的单行文本框,只需使用 <input> 标签和 type="text" 属性:

<input id="ExerciseTimes" asp-for="ExerciseTimes" style="height:25px;" class="form-control" 
       type="text" />

但是,如果您想要没有滚动条的固定大小 <textarea> 元素(在示例图像中看起来像微调器),请同时使用 CSS 样式 overflow:hiddenresize:none

<textarea id="ExerciseTimes" asp-for="ExerciseTimes" style="height:25px;" class="form-control" 
          style="overflow:hidden;resize:none"></textarea>

注意: 您可以应用包含上述两种样式的附加 CSS class(例如 noscrollbar)并将其附加为 [=21] =].