asp.netcssasp.net-mvc-3razoractionlink

ActionLink with multiple classes in ASP.NET MVC3


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" })

Solution

  • 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:

    LinkOutput