+ 3
What is the diffrens bettwen getting style in css by id and by class
7 Respuestas
+ 8
Thare is no difference when using them
For example if you have an id on on a paragraph <p> called “text1” and a class on the same tag called “text2” there will be no difference
However the only difference is the way you call them:
For id: Use - #
#text1 {
}
For class: Use - .
.text2 {
}
Note - id’s are unique, therefore
can only be used once in
html element.
- classes can be used as
many times as you wish on
an element
+ 3
thanks:3
0
Also, the styling by ID will replace the styling by class, if there are any clashes -- the most specific selector is chosen.
0
Classes can be shared used as many times as you need while ids are unique and can be used only once.
Class and ID are kind of self-explanatory keywords.
0
https://code.sololearn.com/W7sflPVjJY8z/?ref=app
they realy are same:3 no repeats
0
https://www.sololearn.com/Discuss/1425768/?ref=app
Hope this helps ☺️☺️.
0
Briefly, id style used for one unique item only, where the class style can be used many times as you like (reusability).