Styling Hyperlinks
The following link states can be styled using CSS to provide visual feedback to users during interaction with links.
| Link State | CSS Pseudo-class | Description | Example |
|---|---|---|---|
| Normal State | a | This is the default state of a link before any interaction. | <a href="https://example.com">Click Here</a> |
| Hovered State | a:hover | Activated when the user hovers over the link, typically used to indicate interactivity. | a:hover { color: blue; } |
| Visited State | a:visited | This state represents a link that the user has already clicked and visited. Often styled to show the user that they have previously interacted. | a:visited { color: purple; } |
| Active State | a:active | Triggered when the link is being clicked or activated. It lasts only for the duration of the click. | a:active { color: red; } |
| Focus State | a:focus | Indicates that the link has received focus, such as when a user navigates to it using the keyboard (e.g., tabbing). | a:focus { outline: 2px solid blue; } |
Link states are decorated using CSS pseudo-classes and can be customized with different styles to give the user visual feedback about the link’s state.