Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 415
Ronald Avatar asked Aug 16 '11 04:08

Ronald


People also ask

How do I change the color of an ActionLink in HTML?

@Html. ActionLink("name", "Action", "Controler", new { id= sentId, Style = "color:White" }, null);

How do I change the link text color?

In the "Styles:" section, select Hyperlink, and then click Modify.... From the list under "Font Color:", choose the color you want. To save your changes, click OK, and then OK again.

What is HTML ActionLink in ASP NET MVC?

Html. ActionLink creates a hyperlink on a view page and the user clicks it to navigate to a new URL. It does not link to a view directly, rather it links to a controller's action.

What is the difference between using URL action and HTML ActionLink in a view?

Yes, there is a difference. Html. ActionLink generates an <a href=".."></a> tag whereas Url. Action returns only an url.


1 Answers

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 }
like image 159
dahlbyk Avatar answered Sep 21 '22 06:09

dahlbyk