applying a css class to asp.net core asp-controller anchor tag

maqskywalker
maqskywalker used Ask the Experts™
on
I have a Asp.Net Core Application.

On one of my views I have an anchor tag like this this.

<a asp-controller="Speaker"
   asp-action="Index">All Speakers</a>

i have a CSS class that looks like this:

.LinkStyle1 a:link { color: #0000FF; }

Is there a way to add this class style to the asp-controller link tag?

One way that works is like this:

<span class=“LinkStyle1”><a asp-controller="Speaker"
   asp-action="Index">All Speakers</a></span>

Is there a better way to apply a css class to this asp-controller tag?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Software Engineer
Top Expert 2009
Commented:
IF your intention is to change only some of your links, then you approach is the correct one.

Note: Otherwise for all links in your page you should use:
a:link { color: #0000FF; }

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial