1

Below is my code and I set the values for columns and rows correctly or at least I thought I did but it won't change from the default size of the text area. What have I done wrong?

<div class="row">
    @Html.LabelFor(model => model.fullName, "Name:")
    @Html.TextAreaFor(model => model.fullName, new { @cols="160", @rows="1" })
    @Html.ValidationMessageFor(model => model.fullName)
</div>
1
  • Just a quick note, you don't need the @ for "cols" and "rows". You only need it when you are using a reserved word, such as @class Commented Apr 10, 2014 at 4:24

1 Answer 1

3

cols and rows are relative to font size. height and width, also line-height and letter-spacing if explicitly set as well.

So use height width properties

@Html.TextAreaFor(model => model.fullName, new { @Style="height:400px; width:300px;" })
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.