html

How do you Change the Color of a Link in HTML

In HTML, you can conveniently navigate from one web page to the next just with the help of a single clickable link. HTML provides a very quick and simple way of inserting clickable links within the scripts. Apart from this, it also allows you to customize the appearance of these links. You might wonder why is there a need to customize the HTML links when there is already a well-defined format in HTML for these links. Well, you might want to do this because your entire web page follows a well-defined layout, and you also want your HTML link to follow that theme. Therefore, in this guide, we will highlight the method of changing the color of a link in HTML.

Changing the Color of a Link in HTML:

Before learning the method of changing the color of a link in HTML, we would like to show you the default color of an HTML link so that when we will change it later, you will easily be able to recognize the difference. To demonstrate to you that, we have written the following simple HTML script:

In this HTML script, we have simply mentioned an HTML link by using the “href” tag in HTML.

When we executed this script with our browser, the web page shown below appeared on our screen. From here, you can see that the default color of an HTML link is blue.

Now, we will attempt to change this color to red. To do that, we have slightly modified the above HTML script in the following manner:

In this modified HTML script, we have simply used the “style” attribute of HTML with our link, and using this attribute, we have set the color of this link as red.

Upon execution of this modified script, our HTML link color changed to red, as you can witness from the web page shown in the image below:

Conclusion

With the help of this quick tutorial, you can instantly change the color of your HTML links. We have changed the default color of an HTML link to red in this guide. However, you can choose any color of your choice in which you want your HTML link to be displayed simply by mentioning its name with the “style-color” attribute of HTML.

About the author

Ayesha Sajid

Ayesha Sajid has secured a Bachelor's degree in Computer Sciences and a Master's degree in Information Security. She is a technical content writer by profession who has around four years of experience in working with Windows and different flavors of the Linux operating system. She also has a keen interest in exploring the latest technology trends.