CSS · CSS Tutorial · Lesson 17
CSS Links
Style links in their different states.
Links can be styled with any CSS property, and differently depending on their state.
Example
<style>
a:link { color: #04AA6D; text-decoration: none; }
a:visited { color: purple; }
a:hover { color: hotpink; text-decoration: underline; }
a:active { color: blue; }
a.button { background: #04AA6D; color: white; padding: 10px 20px; border-radius: 6px; display: inline-block; }
a.button:hover { background: #037a4e; }
</style>
<p><a href="#">A styled link</a></p>
<a class="button" href="#">Link as a button</a>
Tip:
a:hover must come after a:link and a:visited; a:active must come after a:hover (remember "LoVe HAte").Keep reading “CSS Links”
Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.