CSS code to change the color of hyperlinks on th table header:
To change the color of hyperlinks in a table header (th) element in CSS, you can use the followings pseudo-classes to target different states of the hyperlink.
- :link,
- :hover,
- and :active
- :visited
For example:
th a:link { color: blue; } th a:hover { color: green; } th a:active { color: yellow; } th a:visited { color: pink; }
- Normally the hyperlink color will be blue
- Pink when hyperlink has been visited,
- Green when the user hovers over on hyperlink,
- Yellow when the user is actively clicking on hyperlink.
You can also use the color property to change the color of all hyperlinks within a table header at once, like so:
th a { color: green; }
This will change the color of all hyperlinks within the table header to green, regardless of their state.