+ 7

Why we are using class ? Is it necessary

10th Dec 2017, 7:06 AM
Priyanka
Priyanka - avatar
4 Answers
+ 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.
10th Dec 2017, 7:31 AM
ThreeG
ThreeG - avatar
+ 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.
17th Dec 2017, 1:47 PM
ItzJimoh
ItzJimoh - avatar
+ 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.
10th Dec 2017, 7:11 AM
Dima Makieiev
Dima Makieiev - avatar
+ 1
yaa it is necessary ......as it act like a tag on the programme that helps us to determine the programme
19th Dec 2017, 12:40 AM
RITIKA
RITIKA - avatar