How to change the font & color when using Html.TextAreaFor?

22,521
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription, 
    new { cols = "40%", style = "color:red;" })%>

or apply a css style:

<%= Html.TextAreaFor(m => m.Component.ApplicationDescription, 
    new { cols = "40%", @class = "foo" })%>

which could look like this:

.foo {
    color: red;
}
Share:
22,521
AwkwardCoder
Author by

AwkwardCoder

Updated on June 29, 2020

Comments

  • AwkwardCoder
    AwkwardCoder almost 4 years

    I'm using following code to display some text and it won't change the font color, anyone know why?

    <%= Html.TextAreaFor(m => m.Component.ApplicationDescription, new { cols = "40%", Style = new Style { ForeColor = Color.Red } })%>