What is the difference between type, I'd and class selectors ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between type, I'd and class selectors ?

27th Dec 2022, 3:05 PM
Trishant Mishra
Trishant Mishra - avatar
3 Answers
+ 4
as the names indicate, type sector select elements of a given type, class selectors select elements with the given class on them and id selectors select an element by its assigned id. Selectors will be covered in the CSS course.
27th Dec 2022, 3:07 PM
Lisa
Lisa - avatar
+ 4
Id is unique and we can have only 1 id #myId { } class is used if we have multiple elements, so we can select all of them and set style .myClass { } type selector is for element name, it will target every element with this name and apply style to it p { }
27th Dec 2022, 3:10 PM
PanicS
PanicS - avatar
0
Thanks Lisa and PanicS 🧡
27th Dec 2022, 3:26 PM
Trishant Mishra
Trishant Mishra - avatar