Pseudo-elements: Links

  1. Pseudo-elements
  2. Visitor feedback

If we want to change the properties of linked text, we can apply our changes directly to the “a” element:

a {

color: orange;

}

However, doing that will make linked text always orange. Applying styles to the “a” element does not distinguish between visited and unvisited links. For that, we have the pseudo-elements “link” and “visited”. Replace the “a” style we just made with:

a:link {

color: rgb(74, 36, 199);

font-weight: bold;

}

a:visited {

color: orange;

}

image 14

This specifies orange for visited links, but “rgb(74, 36, 199)” for unvisited links. Besides named colors, we can create custom colors with a specific amount of red, green, and blue. Color numbers go from 0 to 255. You can also use 0% to 100%, but most color pickers will give you the 0-255 range rather than percentages. Here, we’ve specified a red of 74, a green of 36, and a blue of 199.

  1. Pseudo-elements
  2. Visitor feedback