Apply a class to href

I want to apply a class to this so it’s used in certain links. Can I apply it as is or does it have to be restructured to apply a class?

<style>

 A:link { 
color : #1e5186; 
text-decoration : none; 
} 
A:visited { 
color : #1e5186; 
text-decoration : none; 
} 
A:hover { 
color : indianred; 
}

</style>

Thank you

Something like this you mean?

css

:link,
:visited { 
  color : #1e5186; 
  text-decoration : none; 
}

// could be any name, I have used 'warning'
.warning:hover {
  color : indianred;
}

html

<a href="https://sitepoint.com" class='warning'>Sitepoint</a>
2 Likes

Yes, thanks. That makes it easier to work with.

I appreciate your time, thanks!

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.