ID vs CLASS in CSS. Please explain in detail with example

后端 未结 8 1830
不思量自难忘°
不思量自难忘° 2021-01-29 11:46

I have heard that ID is unique and can only be used once in a page, but its working fine when used over multiple times on a page. Please let me know the purpose of ID and hows i

8条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-29 12:09

    If you care for XHTML/HTML validation, then you should use unique IDs.

    See this:

    Class vs. ID

    And

    Why must the ID attribute be unique on each page?

    Hope it helps.

提交回复
热议问题