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?

1
  • 1
    maybe this link help you link Commented May 10, 2012 at 14:23

2 Answers 2

21
Html.ActionLink("Link Name", 
                "ActionName",
                "ControllerName",
                null,
                new { @class = "myCssClass" }
                )
Sign up to request clarification or add additional context in comments.

2 Comments

this doesn't give the resulting anchor tag a class but passing class as a parameter to the ActionName action.
@SachinKainth Sorry I missed a parameter out! Please try again
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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.