+ 7
Why we are using class ? Is it necessary
4 Réponses
+ 3
We use classes because usually there is a need to apply some styling to various elements. Basic example - you want to set red background to imoportant elements on your website, then you create class and apply it to these elements. Moreover, HTML elements has their own styles like input have border, "a" have underline, so you can overwrite it using classes.
+ 3
Classes are needed to give unique styling to certain parts/components of a page. It offers the advantage of being able to be used in multiple tags hence, providing CSS a good way to style each of the tags independently, unlike id-tags that can only be used once in a page.
+ 1
It is not necessary but it helps to refer some specific elements from css and assign some property for them. For example you can have 2 inputs with different class attitude, so you can assign border property for all inputs but background color only for inputs of specific class.
+ 1
yaa it is necessary ......as it act like a tag on the programme that helps us to determine the programme