ASP.NET MVC Html.ActionLink hyperlink color

The ActionLink() method is overloaded. Some of those signatures allow for the passing of a parameter object htmlAttributes.

You can do something like this:

Html.ActionLink("foo", "bar","baz",   
            new { id = 1}, //   Route args if needed; null if not.
            new {@style="color:#000aaa;" }
            );

Perhaps you have a CSS class already defined:

Html.ActionLink("foo", "bar","baz",   
            new { id = 1}, //   Route args if needed; null if not.
            new {@class="MyClass;" }
            );

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 }

try, this way also will helpful to someone

Html.ActionLink("Your Link", "YourAction")

<style>   
  a{
        color: #FF5722;
        text-decoration: none;
    }

//if needed hover
  a:hover {
            color: #FF5722;
     }
//Likewise active,visited
</style>

Some explainations base on @dahlbyk answer

  • a:link - a normal, unvisited link
  • a:visited - a link the user has visited
  • a:hover - a link when the user mouses over it
  • a:active - a link the moment it is clicked

When setting the style for several link states, there are some order rules:

  • a:hover MUST come after a:link and a:visited
  • a:active MUST come after a:hover

More detailes can be found here