zaro

What is the hex code for links?

Published in HTML Link Colors 2 mins read

What Are the Default Hex Codes for Links in HTML?

The default hex codes for links in HTML vary depending on their state: unvisited, visited, or active. These colors are set by the web browser to provide visual cues to users about their browsing history.

Default HTML Link Colors

Web browsers assign specific default colors to hyperlinks to distinguish between links that have been clicked and those that haven't, as well as the moment a link is being activated. Here are the standard default hex codes for different link states:

Link State Default Color HEX Code
Unvisited Link Blue #0000FF
Visited Link Purple #800080
Active Link Red #FF0000

Understanding Link States

  • Unvisited Link: This is the default appearance of a hyperlink that the user has not yet clicked or followed. It typically appears in a vibrant blue.
  • Visited Link: Once a user clicks on and navigates to the page linked by a hyperlink, the link changes to a "visited" state. This usually makes the link appear purple, helping users easily identify which links they've already explored.
  • Active Link: This state refers to a link that is currently being clicked or activated by the user (i.e., the mouse button is pressed down on the link). For a brief moment during this action, the link turns red before navigating to the new page.

Customizing Link Colors with CSS

While these are the default colors, web developers commonly use Cascading Style Sheets (CSS) to customize the appearance of links to match a website's branding or design. This provides a consistent and visually appealing user experience. You can override these defaults using CSS pseudo-classes like a:link, a:visited, a:hover (when the mouse pointer is over the link), and a:active.

For more detailed information on HTML link colors and styling, you can refer to resources like SitePoint.