9

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?

Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304

2 Answers2

21
Html.ActionLink("Link Name", 
                "ActionName",
                "ControllerName",
                null,
                new { @class = "myCssClass" }
                )
Curtis
  • 101,612
  • 66
  • 270
  • 352
0
@Html.ActionLink("Forgot Password ?", "ViewName","ControlerName",null, new { @class="Link"})

Add Link class is <head> tag

<style type="text/css">
        .Link
        {
            margin-bottom:20px;
            color:blue;
            font-weight:bold;
        }
    </style>
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Jeetendra Negi
  • 443
  • 3
  • 3