This forum is now read-only. Please use our new forums! Go to forums
Combining Pseudo-Class Selectors with
If I enclose my <a>
links in <div>
or <p>
tags, the color attributes that I assign to my pseudo-class selectors do not display in the preview window.
For example, my html code for the links are as follows:
<body>
<p><a href="http://www.reddit.com/">Link1</a><p>
<p><a href="http://www.reddit.com/">Link2</a><p>
<p><a href="http://www.reddit.com/">Link3</a><p>
</body>
My psuedo-class selectors are defined as:
a:nth-child(1) {
color:#CDBE70;
}
a:nth-child(3) {
color:#ffc125;
}
a:hover {
text-decoration:none;
color:black;
}
I tried the following modification to no effect as well:
p a:nth-child(1) {
color:#CDBE70;
}
p a:nth-child(3) {
color:#ffc125;
}
a:hover {
text-decoration:none;
color:black;
}
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
That seems to have fixed it! Seems to make sense as well;
are the direct children, followed by in terms of how the code is written. Thank you!