Basic Css type selector

What is difference between the first one starting with “.” and the second one called type selector?
Screenshot 2022-09-24 at 23.36.56

well you know how elements have types?
like body type or p type (paragraph) or input type?
The second selector is how you select any element of a specific type.

And do you know how you can add an attribute to an element to give it a class?
(like in school? elements can belong to classes)
The first selector selects by class.
So you have any element of any type but select them all if they all have the same class.

Both .price and footer are selectors. The difference between them is that the first is a class selector. It will target any element that has the class price, regardless of type. The second one will target all elements with they type of footer.

<someElement class="price">I will have right-aligned text and a width of 25%</someElement>
<footer>My font size will be 14px</footer>

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