What is the impact of multiple IDs for the same page _css/html

Source: Internet
Author: User
We know that when a style sheet defines a style, you can define the ID or define the class, for example:

Id Method: #test {color: #333333} to invoke content in the page


Class method:. Test{color: #333333}, invoking content in the page

ID A page can be used only once, class can be referenced multiple times.

A netizen asked, ID and class as if there is no difference, I used a number of IDs in the IE display also normal, with multiple IDs have any impact?

Answer: The first effect is not through the W3 calibration.

On the page display, the current browser also allows you to make this error, with more than the same ID "in general" can also be displayed normally. But when you need to use JavaScript to control the DIV with the ID, there will be an error.

The ID is a label that distinguishes between different structures and content, like your name, and if a room has 2 people with the same name, there will be confusion;
Class is a style that can be set on any structure and content, like a garment;
Conceptually, it's not the same:
The ID is the first to find the structure/content, and then to define the style, class is to define a style, and then set to multiple structures/content.

Web standards want people to use strict habits to write code,

For example: You can use the display in bold, or can be used to display, but it is recommended for everyone, because more semantic

If you do not pay attention to these details, feel indifferent,
Then you have no need to transition to XML, there is no need to learn the Web standard, because the Web standard application is the change from these small details to start, otherwise with the current HTML is not also possible?

  • Related Article

    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.