I'm playing with link colours and am struggling over one particular issue.
My CSS code is:
a:link {
text-decoration: none;
colour: white;
}
a:visited {
text-decoration: none;
color: purple;
}
a:hover {
text-decoration: underline;
color: #C0C0C0;
}
Everything is functioning perfectly, except that the default link colour isn't changing. The hover and visited colours are changing as per the commands, I can add or remove underlines from the default link style, I can change the colour of the default text background, and it all works just fine. It's just the text colour of the default link that I seem unable to manipulate. I have tried using just a: instead of a:link but that makes no difference. If I use the old
<body link="white">
technique then the default colour changes as required, but I need to do this in CSS.
Can anyone suggest why just this one function isn't working for me?
As far as CSS color is concerned, links, or <a> tags, behave in the same way as regular text. This means to change the color of a link all you need to do is use the CSS color property on the anchor tag with whatever color Hex you want, in the example below we use red.
To change the color of links in HTML, use the CSS property color. Use it with the style attribute. The style attribute specifies an inline style for an element. Use the style attribute with the CSS property color to change the link color.
To change the color of hyperlink text, click Hyperlink, and then click More Colors. To change the color of the followed hyperlink text, click Followed Hyperlink, and then click More Colors.
Default value of links:Normal/unvisited links are blue. Visited links a colored purple. Active links are colored red.
You have a typo:
colour: white;
Should be:
color: white;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With