We know that when defining a style in a style sheet, you can define an id or a class, for example:
ID method: #test{color:#333333}, call <div id="test">content<div> in the page
CLASS method: .test{color:#333333}, call <div class="test">content<div> in the page
The id can only be used once on a page, and the class can be referenced multiple times.
Some netizens asked, there seems to be no difference between id and class. If I use multiple ids on the page, it will display normally in IE. Is there any impact of using multiple ids?
Answer: The first impact is that it cannot pass W3 verification.
In terms of page display, current browsers still allow you to make this mistake, and using multiple identical IDs can display normally "under normal circumstances". But when you need to use JavaScript to control this div through id, an error will occur.
ID is a label used to distinguish different structures and contents, just like your name. If there are two people with the same name in a room, confusion will occur;
Class is a style that can be applied to any structure and content, just like a piece of clothing;
Conceptually speaking, they are different:
ID is to find the structure/content first, and then define the style for it; class is to define a style first, and then apply it to multiple structures/content.
Web standards hope that everyone will use strict habits to write code.
For example: you can use <b></b> to display bold, or you can use <strong></strong> to display it, but W3C recommends that you use <strong> because <strong> is more semantic.
If you don't pay attention to these details and think it doesn't matter, then there is no need for you to transition to XML, and there is no need to learn web standards, because the application of web standards starts from changes in these small details, otherwise it is not possible to use current HTML. Can?