CSS Links


With CSS, you can change the appearance of links in various ways.


Text Link Text Link Link Button Link Button

Styling Links

Links can be styled with any CSS property (e.g. color, font-family, background, etc.).

The four links states are as follows:

  • a:link - a normal, unvisited link
  • a:visited - a link the user has visited
  • a:hover - a link when the user hover over it
  • a:active - a link the moment it is clicked

When you're choosing how links should look in different situations, there are specific rules to follow regarding the order of styles:

  • a:hover MUST come after a:link and a:visited
  • a:active MUST come after a:hover

Text Decoration

The text-decoration property is mainly used to get rid of the lines under links.


Background Color

You can use the background-color property to assign a color for the background of links.


Link Buttons

This example shows a more advanced way to use CSS properties to make links look like boxes or buttons.