如何在MVC Html.TextBox上应用css类

Rit*_*itz 0 css asp.net-mvc

我的MVC应用程序中有以下标记.如何将课程应用到我的文本框中?

<%= Html.TextBox("username", "", new { maxlength = 50 })%>
Run Code Online (Sandbox Code Playgroud)

Dou*_*ner 10

<%= Html.TextBox("username", "", new { maxlength = 50, @class = 'your-classname' })%>
Run Code Online (Sandbox Code Playgroud)

然后在你的CSS文件中你将使用这个选择器:

.your-classname { ...css rules here... }
Run Code Online (Sandbox Code Playgroud)