ASP.NET MVC 3 Razor - Adding class to EditorFor

后端 未结 16 2108
长情又很酷
长情又很酷 2020-11-27 11:09

I\'m trying to add a class to an input.

This is not working:

@Html.EditorFor(x => x.Created, new { @class = \"date\" })
16条回答
  •  不知归路
    2020-11-27 11:52

    I used another solution using CSS attribute selectors to get what you need.

    Indicate the HTML attribute you know and put in the relative style you want.

    Like below:

    input[type="date"]
    {
         width: 150px;
    }
    

提交回复
热议问题