We can easily change style links depends on its status. Mainly links are depends on four status.
- Link
- Hover on link
- Visited link
- Active link
In following article, we are change the color of links based on its status.
Write below code in html file :
<div class="wrapper"> <h2>Different Color Of Link At Different Status</h2> <a href="https://www.instagram.com" target="_blank">Instagram</a> <div class="mt-2"> <h3>Different status colors</h3> <span class="link">Link</span> <span class="visit-link">Visited Link</span> <span class="hover-link">Hover on Link</span> <span class="active-link">Active Link</span> </div> </div>
Write below code in CSS file :
a:link, .link { color: rgb(238, 120, 3); background-color: transparent; text-decoration: underline; } a:visited, .visit-link { color: rgb(240, 72, 134); background-color: transparent; text-decoration: underline; } a:hover, .hover-link { color: rgb(9, 120, 110); background-color: transparent; text-decoration: underline; } a:active, .active-link { color: rgb(203, 0, 254); background-color: transparent; text-decoration: underline; }
Output :