I am trying to develop my html/css skills but for some reason when I am trying to use color attribute for my .home:link and .about:link , it is not working. For others like the heading and .home:hover and .about:hover , etc , it is working perfectly fine. Here is the code :
/* Home link */
.home:link {
text-decoration: none;
color: #ffffff; /* Ensure the color is white */ /* issue is here: */
font-size: 25px;
font-family: 'Shadows Into Light';
}
.about:link {
text-decoration: none;
border-radius: 3px;
font-size: 25px;
color: #ffffff; /* Ensure the color is white */ /* issue is here: */
font-family: 'Shadows Into Light';
}
Do you have the corresponding HTML code to share with us please?
Also, when posting code on the forum, you’ll need to enclose it within backticks to ensure that it displays correctly.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
I got white as noted above but when I changed the href links to another web l ink I got purple text as the default. Is that your issue?
As an observation on your html, is there any reason why you have used classes rather than ID’s. Classes are usually to apply the same class name to several elements where the styling is the same. As far as I can see your class names are all different so an id name may be more appropriate. ID’s have a higher priority in CSS than classes as well.
thank you for helping me out . The issue was that the font was not coming white in my page . But after reading your comment and the comment below , I added an extra colour for when the link was visited and like the other comment said , it was because I had already visited the page that it remained purple for me .
Thank you . You made me realise where I went wrong . It was not with the code , it was just as you had said. I had already visited the page which was why it was not turning white for me . For the answer to classes, there was no reason in particular for it. But I will change it to ID from now on . Thank you for stating that