What is the impact of multiple IDs on a single page?

Source: Internet
Author: User

We know that when a style table defines a style, you can define the ID or class, for example:

Id method: # test {color: #333333}, call the content on the page

Class Method:. Test {color: #333333}, call the content on the page

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 this Div 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.

The Web standard is intended to be written in strict habits.Code,

For example, you can use the bold text to display the data, but W3C recommends that you use it because it has more semantics.

If you do not pay attention to these details,
So you don't have to transition to XML, and you don't have to learn about web standards, because Web standard applications start from the changes in these small details, otherwise, can I use the current HTML?

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.