FAQ: Selectors - Type

This community-built FAQ covers the “Type” 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 Type

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 Language Help.

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

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

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 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! here’s my question: are the spaces in the declaration necessary or are they optional. p.ex could i write color:blue; instead of color: blue; or would that be semantically incorrect?
thank you!

1 Like

The spaces aren’t necessary, per se, just helpful to others (and sometimes even yourself) when there’s spacing and proper indenting in your code.

But either way, it’s not semantically incorrect, so don’t worry :slight_smile:

3 Likes

Thank you so much! :smiley:

You’re welcome!! Happy coding!! :grinning:

1 Like

the space is for readability.

1 Like

Hi,
Can one style the

elements differently? How do i style one paragraph red and the other yellow? Thanks

As you progress through the lesson, you will be utilizing class and id selectors to achieve the goal. (specifically here → Learn CSS | Codecademy)

Or you can also use the chaining method of multiple selectors (here → Learn CSS | Codecademy)

Hey, question: what if there’s more than 1

for example, if theres 2 p’s, how would CSS know which one to style?
Is it like the order of the HTML list, like it’ll style the first one then the second, etc.

Generally speaking, once we give CSS a rule to style P nodes as such, it applies to all of them. This is known as ‘generic’ and is a fundamental principle when learning the cascade. Without saying much else, I will say, don’t give this a passing glance. Stay with it and learn. Skip this stage at your own peril.