ActionLink with multiple classes in ASP.NET MVC3

2019-05-06 04:22发布

问题:

I'm curious, is it possible to use multiple CSS classes on an ActionLink in MVC3 Razor syntax? The line below appears to load only the first class(btn) and skipps btn_c.

@Html.ActionLink("Administration", "Index", "Admin", null, new { @class = "btn btn_c" })

回答1:

I've just used your existing ActionLink with the following css:

.btn
{
    color: yellow;
}

.btn_c
{
    background-color: red;
}

And it successfully produced the following output: