Beginner - Class in CSS

Hello, i am a beginner in this field and i have joined the Responsive Web Design course to learn about HTML and CSS. Right now im in Learn basic CSS by building a cafe menu and so far i have understood everything that i’ve been taught except for this one thing (sorry if i can’t manage to make myself explain my doubt well enough beforehand).

Why does this Class in CSS has a p after it when the other classes does not?

*Is the line 42
*The entire code can be seen on the step 73 of the " Learn basic CSS by building a cafe menu "

What you did not understand on line 42?

Why does it have a p after .item?, the other classes dont have it

in css, we create selectors to target different elements in the html.

There are multiple ways to target elements.
One way is when we want to target all descendants of a specific element.
In this case we have
.item p

which means i want to select all p elements nested within any .item element.

If I just wanted p elements in general I wouldn’t need the .item in front.
So the way this is written has a special meaning.
You will learn more css selectors as you progress.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.