WooCommerce Change Link color only for specific link

Viewed 221

I have this code to insert links and change their color. My problem is when I use this code, all the links on a page change their color to this settings. But I want these colors only for this link, the other links should keep their color.

Can anyone help me?

<!DOCTYPE html>
<html>
  <head>
    <style>
      /* unvisited link */
      a:link {
      color: #9c1006;
      }
      /* mouse over link */
      a:hover {
      color: #000000;
      }
      </style>
  </head>
  <body>
    <a href="link">link text</a></p> 
1 Answers

You need to add a "class" attribute in your html tag like:

<a href="link" class="custom-link">link text</a></p> 

Then your CSS related rules will be instead:

/* unvisited link */
a.custom-link:link {
    color: #9c1006;
}
/* mouse over link */
a.custom-link:hover {
    color: #000000;
}
Related