FrontendDeveloper.in

HTML question detail

What is the difference between `id` and `class`?

id should be unique in a document and is best for one specific element. class can be reused across many elements.

Use class for styling patterns and component states. Use id for unique relationships like label associations or in-page anchors.

Back to all HTML questions
Get LinkedIn Premium at Rs 399