White Island White Island - 1 year ago 103
HTML Question

How can I change the size of a multi-line editor-field?

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 class="editor-field">
@Html.EditorFor(model => model.Body)
@Html.ValidationMessageFor(model => model.Body)

and from my model:

public string Body { get; set; }

Answer Source

I would do this with CSS:

<div class="editor-multiline-field">
     @Html.EditorFor(model => model.Body)
     @Html.ValidationMessageFor(model => model.Body)

and then in your CSS file define the width and height to the desired values:

.editor-multiline-field textarea {
    width: 300px;
    height: 200px;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download