Skip to content

HTML change link color inline | (Hyperlink, Anchor tag, href)

  • by

Use CSS color property to change the link color inline in HTML. You can use color code (hex color codes) or direct the name of the color as a value of color.

Examples of Change hyperlink color HTML

There are three ways of changing the herf Hyperlink color: inline, internal, and external CSS.

Inline style method

Add the style attribute directly to the anchor tag and specify the color property through the style attribute, then assign a color value.

<!DOCTYPE html>
<html>
  <body>
    <a href="https://www.google.com/" style="color: red">Google.com</a>
  </body>
</html>

Output:

HTML change link color inline

Internal CSS method

For Internal CSS code you have to use <head> section of your HTML document. In the <style> tag, we set the color of our link <a> tag.

It will change the all anchor tag color if you want only single or specific then set id or class.

change anchor tag color in HTML hyperlink

Q: How to change anchor tag color in HTML?

Answer: Tp changes the color of an HTML link use the CSS color property on the anchor tag with whatever color Hex you want, in the example below used red color.

<head>
  <style>
    a { color: #FF0000; } /* CSS link color */
  </style>
</head>
<body>
  <a href="http://example.com/">A Red Link</a>
</body>

Do comment if you have any questions and suggestion on this topic.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *