Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

declaring link attributes inside a class in css

Why is the second link not yellow? There is the class myclass and there is declared every link’s color inside the class to be yellow. However, it is blue.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>hey I am a title</title>
    <style>
a:link,
a:hover,
a:visited,
a:active {
    color: blue;
    text-decoration: underline;
}

a.myclass:link,
a.myclass:hover,
a.myclass:visited,
a.myclass:active {
    color: yellow;
    text-decoration: underline;
}
    </style>
</head>
<body>

<a href="indexde.htm">first link</a>

<br><br>

<span class="myclass">
    <a href="indexde.htm">second link</a>
</span>

</body>
</html>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Change

a.myclass:link,
a.myclass:hover,
a.myclass:visited,
a.myclass:active {
    color: yellow;
    text-decoration: underline;
}

to

.myclass a:link,
.myclass a:hover,
.myclass a:visited,
.myclass a:active {
    color: yellow;
    text-decoration: underline;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading