FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - Classes and IDs


This community-built FAQ covers the “Classes and IDs” exercise in Codecademy’s CSS lessons.

FAQs on the CSS exercise Classes and IDs

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

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

Need broader help or resources about CSS in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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

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

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

Why do we need a .bold in css when we can use the element in html? Both will make the text appear Bold.

What will happen if two class names have duplicated modification?
For example:
the ‘title’ class will change the color to teal, while the ‘publish-time’ class will change the color to gray
What will happen if in the h6 tag at line 13, I write class=“title publish-time”?
PS: I tried it myself but no matter how I order them, the result will be the time changed to gray instead of teal.

It appears that the instructions for this lesson aren’t correlating with the code. For example, on page 10/17 its asking to add a “class attribute” on line 13, but its actually supposed to be on line-16. I tried to reload, just in case it was on my part, but nothing changed. What happened?

Actually, nevermind, this mistake was on me. I had 3 spaces in between my codes, causing empty lines. Problem solved.

What is the point of adding in a class attribute when literally all you have to do is select h6 in CSS.

h6 {
color: gray;

This is faster and easier. Why would I not just do this?

Because you might have multiple h6 elements in your HTML and you may not want all of them to be styled exactly the same.


If you actually change the order in style.css you will see that the one that comes up first is the one that will be applied. Not sure how that works though.

Because you don’t want to bold every single line of code.

How do you recommend to order the selectors of the CSS file?

I have two questions:
1: can i separate a class or id attribute in CSS if they are linked together with “-” ? for example: class=“large-title”
2: in the example we have to write the color “gray”, however, if I spell it “grey” is that ok, too?

Are class names made up based on its use? In this example, we used the class name “publish-time” to change the “published: 2 days ago” text to gray.

Nevermind :slight_smile: The next lesson “Specificity” answered my question.

what is that mean by “While classes are meant to be used many times, an ID is meant to style only one element”?

please explain and show us an example.

Thank You.

2 Days Ago
.publish-time { color: gray; }