Smal SEO Tool

CSS Links

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

Styling Link States

Links have different states that can be styled using pseudo-classes:

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

Example

css
/* unvisited link */
a:link { color: red; }

/* visited link */
a:visited { color: green; }

/* mouse over link */
a:hover { color: hotpink; }

/* selected link */
a:active { color: blue; }
Try it Yourself »

Text Decoration

The text-decoration property is most often used to remove the default underline from links.

Example

css
a:link, a:visited {
  text-decoration: none;
}
Try it Yourself »

Link Buttons

With CSS, links can be styled to look like buttons, providing a larger, more accessible click area.

Example

css
a.button {
  background-color: #4CAF50;
  color: white;
  padding: 14px 25px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}
Try it Yourself »

Test Yourself with an Exercise

Which pseudo-class is used to style a link when the mouse is over it?