0

why are the classes(.xxxx) refered to with a letter in front?. p.xxxx is more work. only need .xxxx

useless letter in front of class name.

16th Apr 2018, 6:46 PM
Shawn Justshawn
Shawn Justshawn - avatar
7 Answers
+ 17
Assuming its css you talk about: In css, with p.class you get all <p> elements that belong to the class, without that letter, you get all elements that belong to the class regardless of their type, this way you can chain tags, ids, classes etc to identify which html elements will be affected by the css block.
16th Apr 2018, 6:57 PM
Valen.H. ~
Valen.H. ~ - avatar
0
What do you mean?
16th Apr 2018, 6:55 PM
TurtleShell
TurtleShell - avatar
0
CSS using something like.... p.example HTML p class="example". you dont require the p.example when .example works.
16th Apr 2018, 6:57 PM
Shawn Justshawn
Shawn Justshawn - avatar
0
Oh I thought you meant classes in Python
16th Apr 2018, 6:58 PM
TurtleShell
TurtleShell - avatar
0
thanx!
16th Apr 2018, 6:59 PM
Shawn Justshawn
Shawn Justshawn - avatar
0
i suppose you're talking about css classes, in this case the answer is: specificity. p.xxxx is more specific then .xxxx so its properties will be taken. another case could be when you use the same class on different tags.
16th Apr 2018, 7:01 PM
Michele Virgilio
Michele Virgilio - avatar
0
thanx all, now and forever.
16th Apr 2018, 7:03 PM
Shawn Justshawn
Shawn Justshawn - avatar