FAQ: Selectors - Specificity

This community-built FAQ covers the “Specificity” exercise from the lesson “Selectors”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Full-Stack Engineer
Front-End Engineer
Back-End Engineer

FAQs on the exercise Specificity

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!
You can also find further discussion and get answers to your questions over in #get-help.

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head to #get-help and #community:tips-and-resources. If you are wanting feedback or inspiration for a project, check out #project.

Looking for motivation to keep learning? Join our wider discussions in #community

Learn more about how to use this guide.

Found a bug? Report it online, or post in #community:Codecademy-Bug-Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hi,

I’m in the “Specificity” chapter and I ran into a question that I think might be super simple but just want clarification. I typed in my code:

**<h5 class="author-class" id="author-id">By: Stacy Gray</h5>**

It says I got it wrong and I looked at the solution and I found out that it was wrong because of the double quotations around the values and needed single quotations. Is there a difference if I use double quotations VS single quotations in HTML? Does the IDE give an error if I don’t use the right quotations around values?

3 Likes

Hello,

Does anyone here know why the type selector color was used in this exercise rather than the more specific id selector? I thought the id selector would override any other selector already in place.

Amendment: Even though my code was marked as accurate for this exercise, the color changed to yellow, not cornflower blue. Perhaps it is a browser problem?

With thanks,
Ingrid

Hi, Ingrid, I had this impression at first as well. But when I looked again I noticed that what is in yellow (in my case) is the heading ‘Top Attractions’, which is an H5, hence the type selector’s color.
Scrolling up, though, I found that the ‘By: Stacy Gray’ byline right under the main title/H1 was cornflower blue as expected.
Sorry if the suggestion sounds dumb, but as it happened to me, I thought it might help :slight_smile:

Cheers,
Déborah

1 Like

Hi Deborah,

Thank you for your response. I found out that my Dark Reader browser extension was changing most of the colors in the exercises and therefore causing them to be marked wrong.

Your suggestion definitely does not sound dumb, I did the same thing in a later exercise. :slight_smile:

Best Wishes,
Ingrid

@chrismurill , as far as I know, single-quotes vs double-quotes for HTML attributes is a matter of personal preference, and generally people seem to prefer double quotes.

In fact, if you open the dev tools on this very forum you’ll see it’s all double quotes:

image

However the examples for these exercises all use single quotes (presumably the author’s preference!). It seems like the automated tests only accept single quotes as well. IMO the tests should accept either since they are both perfectly valid, seems a bit poor form on the part of the author not to, but who knows, maybe that was difficult to implement.

1 Like

I put the code in this order:

#author-id {
  color: cornflowerblue;
}
.author-class {
  color:pink;
}
h5 {
  color: yellow;
}

It said it was wrong. I put the code the way Codecademy told me and it said it was right. Does order matter?

Yes, it does matter the code between
.index.html and .style.css, has to have the same connection in the order written in index.html and .style.css

[codebyte]
h5 {

color: yellow;

}

.author-class {

color: pink;

}

#author-id {

color: cornflowerblue;

}