4

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" })
Ryan Smith
  • 475
  • 1
  • 8
  • 19

2 Answers2

2

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

Dangerous
  • 4,818
  • 3
  • 33
  • 48
0

I am having this exact problem with bootstrap classes, I do not have another class overriding the bootstrap classes. In fact I verified through dev tools that I can add the "active" class to the "nav-link" class.

Here is my razor code:

@Html.ActionLink("Statement Info", "Edit", new { Controller = ViewBag.MyContoller}, new { name = "navAction", id = "Statements", @class = "nav-link active"})

When I view the element in dev tools, it only has the "nav-link" class

Rich
  • 140
  • 7