Add CSS class to Html.ActionLink

Sachin Kainth picture Sachin Kainth · May 10, 2012 · Viewed 11.1k times · Source

I want to style a link in my page and am using Html.ActionLink to create the link. The problem is I don't know how to style the resulting link. How do I add a CSS class to the Html.ActionLink in order to style it?

Answer

Curt picture Curt · May 10, 2012
Html.ActionLink("Link Name", 
                "ActionName",
                "ControllerName",
                null,
                new { @class = "myCssClass" }
                )