bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/HTML/HTML Foundations
HTML•HTML Foundations

HTML Links - Different Colors

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind HTML Links - Different Colors?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___: green;
3Order

Put the learning moves in the order that makes the concept easiest to apply.

By default, a link will appear like this (in all browsers):
An HTML link is displayed in a different color depending on whether it has been visited, is unvisited, or is active.
HTML Links - Different Colors

An HTML link is displayed in a different color depending on whether it has been visited, is unvisited, or is active.

HTML Link Colors

By default, a link will appear like this (in all browsers):

  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

You can change the link state colors, by using CSS:

Example

Formatted code
<style>
a:link {
  color: green;
  background-color: transparent;

  text-decoration: none;
}

a:visited {
  color: pink;
  background-color: transparent;

  text-decoration: none;
}
a:hover {
  color: red;
  background-color: transparent;

    text-decoration: underline;
}

  a:active {
  color: yellow;
  background-color: transparent;

  text-decoration: underline;
}
</style>

Live preview

Link Buttons

A link can also be styled as a button, by using CSS:

Example

Formatted code
<style>
a:link, a:visited {
  background-color: #f44336;

  color: white;
  padding: 15px 25px;
  text-align: center;

  text-decoration: none;
  display: inline-block;
}
a:hover, a:active {

  background-color: red;
}
</style>

Live preview

To learn more about CSS, go to our CSS Tutorial .

HTML Link Tags

TagDescription
<a>Defines a hyperlink

For a complete list of all available HTML tags, visit our HTML Tag Reference .

Previous

HTML Links

Next

HTML Links - Create Bookmarks