What is the impact of using multiple IDs on the same page? _ experience exchange

Source: Internet
Author: User
What is the impact of using multiple IDs on a single page? when defining a style in a style sheet, you can define IDs or classes, for example:

ID method: # test {color: #333333}, called on the page

Content


CLASS Method:. test {color: #333333}, called on the page

Content


Id: a page can be used only once, and the class can be referenced multiple times.

Some netizens asked, the id and class seem to be no different. I used multiple IDs on the page to display them normally in IE. What is the impact of using multiple IDs?

A: The first effect is that W3 verification cannot be performed.

On the page display, the current Browser allows you to make this error. It can also be displayed normally with multiple identical IDs. But when you need to use JavaScript to control the p through id, an error will occur.

Id is a tag used to distinguish between different structures and content, just like your name. If two people in a room have the same name, they will be confused;
A class is a style that can be embedded in any structure or content, just like a dress;
The concept is different:
Id is to first find the structure/content, and then define the style; class is to first define a style, and then set to multiple structures/content.

Web standards hope that everyone can write code with strict habits,

For example, you can useBold.But W3C suggestsBecauseMore semantic

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.