+ 1

The meaning of "class" ?

On SoloLearn HTML courses, we find in the "blog project: Contact form" this code: <input type="submit" value="send" class="submit" /> What is the meaning of the "class" and what is it used for?

13th Jul 2017, 12:02 AM
JomboT
JomboT - avatar
3 odpowiedzi
+ 7
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,
13th Jul 2017, 2:43 AM
Ipang
+ 9
There are two way to separate your elements into categories. "id" is most often used. If you have a paragraph, perhaps, and gave it the id of "info" (where the styling is defined in your CSS), it eould have those exact details. "class" is useful for more general things. For example, if you have a webpage where the text (headers, paragraphs, et cetera) are all red, you would assign them all the class of "red", and then give them their respective ids.
13th Jul 2017, 12:13 AM
Keto Z
Keto Z - avatar
+ 1
problem solved ..thnks @Ipang and @keto_Z !
13th Jul 2017, 2:57 AM
JomboT
JomboT - avatar