Example: Definitions of multiple id delimiters on the same webpage

Source: Internet
Author: User
Tags class operator
When defining a style in a style table, we can define the id selector or class operator. For example:
ID method: # test {color: #333333}. On the page, call <div id = "test"> content <div>
CLASS method:. test {color: #333333}. On the page, call <div class = "test"> content <div>
Id: a page can be used only once, and the class can be referenced multiple times.
It seems that the id and class are no different. I used multiple id selector in IE to display them normally.
What are the adverse effects of using multiple IDs? The first influence is that W3 verification cannot be passed and does not comply with web standards!
On the page display, the current browser allows you to make this error, and multiple identical id delimiters "generally" can also be displayed normally. But when you need to use JavaScript to control this div through id, it will lead to disorder and a huge error!
Id is a tag used to distinguish between different structures and content. If a person's name and two people in an OFFICE have the same name, confusion may occur. It is often differentiated by different semantics, that is, using different IDs.
A class is a style that can be embedded in any structure or content, just like a dress. However, multiple people wear the same style and style.
In terms of concept, IDs and classes are different. Id is to first find the structure and content, and then define the style. class is to first define a style, and then set it to multiple structures and content.
The web standard is intended for writing code with strict habits. You can use <B> </B> to display the code in bold or <strong> </strong>, however, W3C recommends <strong> because <strong> is more semantic.
If you do not pay much attention to these details, you do not need to transition to xml, and you do not need to learn web standards!
Because standard web applications begin with changes in these small details! Otherwise, can I create a WEB page with 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.