作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在我看来,我有一个名为 Description 的文本区域字段。我希望增加该字段的大小。
我的代码
<div class="col-sm-3">
<div class="form-group">
<span style="color: #f00">*</span>
@Html.LabelFor(model => model.Description, new { @class = "control-label" })
@Html.TextAreaFor(model => model.Description, new { @class = "required", style = " rows=10, columns=40" })
@Html.ValidationMessageFor(model => model.Description)
</div>
</div>
我的文本区域
我想像下面图片中提到的那样带来
所以我在 textarea 字段中给出了行和列。它增加了文本区域的大小。但是当我将页面缩小到手机大小时,意味着所有字段都缩小了。但是这个 textarea 字段不会缩小到页面大小。这是问题
我一直在验证我的字段。我想用红色显示该验证。我正在使用模型验证。
最佳答案
试试这个:
@Html.TextAreaFor(model => model.Description, 10,40, htmlAttributes: new {style="width: 100%; max-width: 100%;" })
关于html - 如何在 html razor view mvc4 中增加 TextArea 的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36995463/
我是一名优秀的程序员,十分优秀!