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:
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 () 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 () below!
You can also find further discussion and get answers to your questions over in #get-help.
Agree with a comment or answer? 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!
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?
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?
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
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.
@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:
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.
I put the code in this order:
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
Does using all of the selecting at the same time for a one element affect to speed of implementation or it doesn’t affect not much ?
when would each specification be necessary and to what task? and why?
Hello, pls I need help, I dont know the reason why my code is not bringing out any color despite the fact that i carried out all the instructions correctly, I mean right from lesson 1 of this chapter.
I would be very happy if someone can help me out with the solution. THANKS
For specificity within a page, why would you go the route of creating an id="" in css versus just doing an an a[*href]. Is the a[*href] exclusively for links to external references so for coloring the link?
Hey, during the “selectors - Specify” section, a question came to my mind. In this chapter, we are told that the lowest order of specificity is a type, then comes the class and then the id selector. But there is a 4th selector which was not covered in that order ranking. The type attribute selector like
i wanted to test it with an img type and realised, that this kind of selector doesnt work with the src attribute. does anyone know why that is the case?
this is the selector i tried to use
i cant upload multiple media in one post yet so i cant show you the img element i tried to change the appearance of
Hey @tera4430519118 welcome to the forums
Try adding an
i at the end of it. Outside of the quotes but inside the brackets. That will make it case insensitive. And I do not see anywhere in the lesson about using those on images.
Hey @not-ethan sorry for answering late.
You are right, it wasn’t specifically in the lessons or one of the exercises to use that kind of selector with an image attribute, i just tried it out to test something. I tried it in a different lesson and it worked perfectly so i’m not sure why it didnt work in the example shown. But the information, that you can add an i to make it case insensitive is interesting, thank you.
In your screenshot, you are searching for the substring
"codecadamy" instead of
OH. Absolutely correct that’s the mistake, thank you
I do not know if this will help as I also have been having problems with this and other sections. If I spend more that a few minutes on a problem and do not get it correct I go to get unstuck, solutions, see the difference between my solution and the correct answer. I then work backwards and re-read the directions. Most of my problems is correctly reading and understanding the directions. It is also very important to go to the forum of every page and read the questions and answer. The forums often make clear to me the directions.