Home >Web Front-end >HTML Tutorial >id selector_html/css_WEB-ITnose
I am a beginner, and I have a question that I still can’t figure out: Regarding the id selector, is it true that a document can only have one id selector? Or can the same id selector only appear once in the same document, that is, a document can have multiple different id selectors? I hope the prawns will give me a clear explanation! ! ! Thank you!
There can only be one id selector.. Match an element based on the given ID
There can only be one id selector.. Matches an element based on a given ID
Wrong. . There is not only one id selector, there can be many. .
Because the ID will not be repeated. .
Quote from 1st floor zsx841021’s reply:
There can only be one id selector.. Match an element based on a given ID
Wrong. . There is not only one id selector, there can be many. .
Because the ID will not be repeated. .
The same id selector can only appear once in the same document, that is, a document can have multiple different id selectors
Within the same page, the same id can only be assigned to one element.
For example, the following writing is wrong: