Ronald Ronald - 6 months ago 205
CSS Question

ASP.NET MVC Html.ActionLink hyperlink color

How can I change the colors of the hyperlink created by the helper function Html.ActionLink?

[additional detail]
The colors will have to be different for each state of the hyperlink, i.e. active, selected, was already selected, etc.

Answer

Typically you would do something like this:

Html.ActionLink("My Link", "MyAction", null, new { @class = "my-class" })

And then use CSS to style my-class:

a.my-class { color: #333333 }
a.my-class:active { color: #666666 }
a.my-class:link { color: #999999 }
a.my-class:visited { color: #CCCCCC }