+ 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

11th Aug 2016, 9:51 AM
zaheer
zaheer - avatar
4 odpowiedzi
+ 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'.
13th Aug 2016, 1:32 PM
Tareque Md Khan
Tareque Md Khan - avatar
+ 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.
14th Aug 2016, 12:40 AM
Jason
0
bt i m confused on basics section they used other syntax and in next section they are using other why
11th Aug 2016, 3:36 PM
zaheer
zaheer - avatar
0
p is a selector but .serif is a name of class, it can be .serif 1 or .serif 2.... etc
12th Aug 2016, 12:02 PM
Mohammed Hamed
Mohammed Hamed - avatar