+ 1
Is there anyone who can guide me about "id" and "class" in HTML?
I am confused about "id" and "class" in HTML! please explain me as simple as you can!
4 odpowiedzi
+ 2
They are attributes that any HTML element can have. Generally, they are used as targets for CSS styling. using #id_name or .class_name to target an id or class. This was I could have several elements with class="green-box" and my stylesheet can target all these with the same styling
ID is also used to target points on the page with a link, so you can have a href="#id_name" to jump to the element with this id. Here lies the key difference - IDs should be unique, whereas classes can appear multiple times.
+ 1
thank you so much
+ 1
Thanks Martin!