There is @Html.EditorFor you need to expand it in height as you fill in the text

Here is the code:

 @Html.EditorFor(model => model.question, new { htmlAttributes = new { @class = "form-control", placeholder = "Вопрос" } }) 

here is the CSS style itself

 .form-control { display: block; width: 100%; height: 34px; position:relative; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; border-color: #ffcf00; border-style: solid; border-width: 3px; background-image: none; border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; } 

How to implement auto expansion?

  • What are you not satisfied with JS-based solutions? - Anton Komyshan
  • I tried zayuzat this jacklmoore.com/autosize regarding class on onlyfor does not work :( @AntonKomyshan - ES

1 answer 1

In general, Trouble decided.

The problem was that it was necessary to use such a structure, then everything was okay

 @Html.TextAreaFor(m => m.Description, new { @class = "form-control" })