Why in id you use #{} in css. and in class you use .{) in css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why in id you use #{} in css. and in class you use .{) in css?

29th Jul 2016, 8:29 PM
Sergii Iusha
Sergii Iusha - avatar
3 Answers
+ 3
Because that is how you tell the browser whether you're selecting a class or an id to modify. Without either, the browser would assume you were selecting an element type like "p" or "body". The "." for class names and "#" for id names is just an arbitrary notation that people decided upon to differentiate between ID, class, and type selectors.
1st Aug 2016, 12:54 AM
Laura Hamrick
Laura Hamrick - avatar
0
.class reference the name within the class .Meanwhile #id keeps a unique identity on other hand . is not used in id because id are mostly called in Javascript...Javascript uses . to call id due to been a Object Orient Script
14th Dec 2016, 10:04 AM
4xMafole
4xMafole - avatar
0
because it's the Css syntax
1st May 2017, 10:57 AM
Irk3n Developer
Irk3n Developer - avatar