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?
Asked
Active
Viewed 1.2k times
9
-
1maybe this link help you [link](http://forums.asp.net/t/1245858.aspx/1) – khaled_webdev May 10 '12 at 14:23
2 Answers
21
Html.ActionLink("Link Name",
"ActionName",
"ControllerName",
null,
new { @class = "myCssClass" }
)

Curtis
- 101,612
- 66
- 270
- 352
-
1this doesn't give the resulting anchor tag a class but passing class as a parameter to the ActionName action. – Sachin Kainth May 10 '12 at 14:41
-
2
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