我怎样才能改变一个多行编辑字段的大小? [英] How can I change the size of a multi-line editor-field?
问题描述
我正在使用C#的MVC项目。现在,我想定制我的意见一点,我想使文本框大。
我跟着这个问题,从单线到多行文本字段中移动建议:
更改Html.TextBox
现在我想调整的多线场,但我不知道在哪里或如何做到这一点。
下面是我从编辑观点摘录
< DIV CLASS =编辑标记>
@ Html.LabelFor(型号=> model.Body)
< / DIV>
< DIV CLASS =主编场>
@ Html.EditorFor(型号=> model.Body)
@ Html.ValidationMessageFor(型号=> model.Body)
< / DIV>
和从我的模型:
[数据类型(DataType.MultilineText)
[显示名称(身体)]
公共字符串车身{搞定;组; }
我会用CSS做到这一点:
< DIV CLASS =主编多行场>
@ Html.EditorFor(型号=> model.Body)
@ Html.ValidationMessageFor(型号=> model.Body)
< / DIV>
和然后在CSS文件中定义的宽度和高度,以所需的值:
。编辑 - 多行场的textarea {
宽度:300像素;
高度:200像素;
}
I'm working on an MVC project using C#. Right now, I'm trying to customize my views a little, and I'd like to make the text boxes bigger.
I followed the suggestions in this question to move from a single-line to a multi-line text field: Changing the size of Html.TextBox
Now I'm trying to resize that multi-line field, but I'm not sure where or how to do so.
Here are snippets from my Edit view
<div class="editor-label">
@Html.LabelFor(model => model.Body)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Body)
@Html.ValidationMessageFor(model => model.Body)
</div>
and from my model:
[DataType(DataType.MultilineText)]
[DisplayName("Body:")]
public string Body { get; set; }
I would do this with CSS:
<div class="editor-multiline-field">
@Html.EditorFor(model => model.Body)
@Html.ValidationMessageFor(model => model.Body)
</div>
and then in your CSS file define the width and height to the desired values:
.editor-multiline-field textarea {
width: 300px;
height: 200px;
}
这篇关于我怎样才能改变一个多行编辑字段的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!