Type selector vs Class selector

Does each of these two ways to style an element produce a different result?


p {
color: red;


.red text p {
color: red;

If by means color yes. The different is how you linked to your index.html page.
second code is not quite right. either you need " - " or " , "

Thanks! Regarding the second code, are you saying that I need a (-) if the name of a class consisted of two words?

Yes. As we know most of the code can’t read plain space bar if it is not a pure text or result.
So it will always begin in your index.html that consisted two words first. then CSS is just about following up with what index.html coded

1 Like

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