+ 1
what is the significance of class- section or selected?
2 Antworten
+ 7
class in HTML is an attribute to give the element a name to link the element to CSS for styling or modified its data via JS. class can link many element, it like class in school where many student inside it. it helped so much when you want to change so many same content.
+ 3
Honestly, classes really don't do too much besides just as a way to refer to an element across different languages. What you're doing is creating several different elements in HTML, assigning them to different classes, and using that class to refer to it in the CSS, allowing you to customize that specific element. The reason that a class was used rather than an ID was because IDs must be unique, meaning only one element can have an ID with a specific value, while classes don't have to be unique and several different elements can share the same class.
Hope this helped!