Home >Web Front-end >HTML Tutorial >id selector_html/css_WEB-ITnose

id selector_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:08:45921browse

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!


Reply to discussion (solution)

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:




can be changed to:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn