bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/HTML/HTML Foundations
HTML•HTML Foundations

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

This chapter

Overview
56

Lessons

191m

Read time

1. HTML Tutorial2. HTML Introduction3. HTML Editors4. HTML Elements5. HTML Attributes6. HTML Headings7. HTML Paragraphs8. HTML Styles9. HTML Text Formatting10. HTML Comments11. HTML Colors12. HTML RGB and RGBA Colors13. HTML HEX Colors14. HTML HSL and HSLA Colors15. HTML Styles - CSS16. HTML Links17. HTML Links - Different Colors18. HTML Links - Create Bookmarks19. HTML Images20. HTML Image Maps21. HTML Background Images22. HTML <picture> Element23. HTML Favicon24. HTML Page Title25. HTML Tables26. HTML Table Borders27. HTML Table Sizes28. HTML Table Headers29. HTML Table Padding & Spacing30. HTML Table Colspan & Rowspan31. HTML Table Styling32. HTML Table Colgroup33. HTML Lists34. HTML Unordered Lists35. HTML Ordered Lists36. HTML Other Lists37. HTML Block and Inline Elements38. HTML Div Element39. HTML class Attribute40. HTML id Attribute41. HTML Buttons42. HTML Iframes43. HTML JavaScript44. HTML File Paths45. HTML - The Head Element46. HTML Layout Elements and Techniques47. HTML Responsive Web Design48. HTML Computer Code Elements49. HTML Semantic Elements50. HTML Style Guide51. HTML Entities52. HTML Symbols53. Using Emojis in HTML54. HTML Encoding (Character Sets)55. HTML Uniform Resource Locators56. HTML Versus XHTML

On this page

HTML Link ColorsLink ButtonsHTML Link Tags