How do I set the width and height of a textarea using CSS?

前端 未结 6 376
夕颜
夕颜 2021-01-17 07:42

Here is my css:

.editor-field textarea {
    width : 400;
    height : 100px;
}

Here is the markup from my view:

        &l         


        
6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-17 08:26

    After some time searching for it, the best way is to use one of the overloads of the method TextAreaFor()

    @Html.TextAreaFor(model => model.Visit.BehavioralObservations, 10, 40, new { HtmlAttributes = new { } })
    

    The 10 is the number of rows, the 40 is the number of columns

提交回复
热议问题