+ 1
Why p.serif{} syntax is used in these font lessons why not .serif p {} this syntax was given in basic css i.e. desendent selectors???
plzzz answer if u knoww well
4 Réponses
+ 3
both have different meaning : 'p.serif' means all p tags having serif class where as '.serif p' means all the p tags under any tag that has a class 'serif'.
+ 3
Tareque above is correct. To elaborate, you can chain selectors in different ways. p.serif means a p tag that has the class serif, p .serif means a tag (not necessarily a p) with the serif class that is within a p tag and p, .serif means all p tags and all tags that have the serif class. Look up the MDN (Mozilla Developer Network) spec sheets for great info.
0
bt i m confused on basics section they used other syntax and in next section they are using other why
0
p is a selector but .serif is a name of class, it can be .serif 1 or .serif 2.... etc