1

I have the following textbox in an MVC6 form.

 <input type="text" asp-for="EmptyTask.TaskDetails" placeholder="New Task" class="txt-newTask" />

And the following CSS:

.txt-newTask{
height: 150px;
min-width: 400px;
max-width: 400px;
}

This appears as such:

Textbox

The "New Task" text appears in the center of the textbox, and continues off the right hand edge if I continue typing.

My goal is to have a single textbox that stretches across multiple lines within that same box.

Any ideas? Thanks!

MGDavies
  • 1,024
  • 1
  • 17
  • 30

1 Answers1

5

If you need multi line text, you should consider using textarea. which is a control designed for this requirement.

There is an mvc textarea tag helper so you can use the asp-for with the textarea like you did with your input field.

<textarea  asp-for="EmptyTask.TaskDetail" class="txt-newTask" 
                                                    placeholder="Enter task"></textarea>
Shyju
  • 214,206
  • 104
  • 411
  • 497