what is the roll of class in HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the roll of class in HTML?

I just want to know the varaity of tasks they could perform.

18th Feb 2018, 7:50 AM
Anshuman Bhuyan
Anshuman Bhuyan - avatar
4 Answers
+ 6
Yes you can define the class name on your own as long as it adheres to the naming rule. (e.g. no whitespace) Here's the reference if you would like to find out more:- https://www.w3.org/TR/CSS21/syndata.html#characters
18th Feb 2018, 8:04 AM
Zephyr Koo
Zephyr Koo - avatar
+ 5
It relates each of the HTML element to a specific group which will be useful for styling similar items with CSS. If you're familiar with social media, you can think of it like a hashtag. The ID of the post must be unique but different posts can share the same hashtag. 😉 We use dot prefix for class selector in CSS and document.getElementsByClassName method in JavaScript to retrieve the items.
18th Feb 2018, 7:55 AM
Zephyr Koo
Zephyr Koo - avatar
+ 2
thank you so much.
18th Feb 2018, 8:30 AM
Anshuman Bhuyan
Anshuman Bhuyan - avatar
+ 1
that's fine my friend but is that group is a selfmade process or an user define or both? I think both.
18th Feb 2018, 7:59 AM
Anshuman Bhuyan
Anshuman Bhuyan - avatar