我正在使用以下代码来显示一些文本,它不会改变字体颜色,有人知道为什么吗?

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

最佳答案

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

或应用 css 样式:
<%= Html.TextAreaFor(m => m.Component.ApplicationDescription,
    new { cols = "40%", @class = "foo" })%>

看起来像这样:
.foo {
    color: red;
}

10-07 14:43