0

Class

What exactly is the function of Class in HTML?

14th Sep 2017, 1:35 AM
Abdul Kabeer Khan
Abdul Kabeer Khan - avatar
3 ответов
+ 10
That is a style definition, a CSS style definition. CSS defines sets of rules to describe how things should look, and (sort of) behave on your web page. CSS uses 2 distinct rules for styling your element, it uses "id" to define a style for a single element, and "class" for multiple elements Think of students in some school, CSS is like the headmaster, when headmaster says "all students wear ties, and black shoes" all the students shall abide, as long as they are classified as students they must follow what headmaster says. The same is for id, take a specific lesson (math for example) if the headmaster says "math is our priority" then the math lesson will be prioritized, amongst other lessons. Hth,
14th Sep 2017, 1:51 AM
P R
P R - avatar
+ 3
a class in html allows you to add a particular style more than once using the same name you can define a class as .cgreen { color : green; /*this makes the text green*/ } now use it in your elements like <p class="cgreen"> the meadow </p> <p class="cgreen"> grassland </p> it simplifies your task, write once use everywhere
14th Sep 2017, 2:34 AM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 1
The HTML class attribute makes it possible to define equal styles for elements with the same class name.
14th Sep 2017, 1:52 AM
Trưởng Nguyễn
Trưởng Nguyễn - avatar