About the use of HTML.

Source: Internet
Author: User

One, labeling problems


For beginners, there is no doubt that the most used tags are div and span, of course, even if only with these 2 tags can write a good-looking page, but why would the web give us so many tags to choose?

From the browser's rendering, the semantic words of the label, it is easier for the browser to render this interface, such as a HTML5 tag heard, browser rendering here is very quick to know, you this is the head, a UL tag, you know is a list, more and more front-end people pay attention to the semantics of the label , we also constantly define more new tags, why we do not use, semantic tags in the work, others take over your code easier to read, in maintenance, faster.

Ii. choice of class and ID

At the beginning of your learning HTML, whether it is a teacher or online teaching has said, try to use class, and to avoid id,id is to be left to JS to use. This problem is same as HTML, since the CSS has given us the ID selector, it has its usefulness, and in CSS3, constantly provide new selectors, we should be reasonable to use the selector, not the entire page is Class,id also has his priority, of course, for the framework of development, That's the class.

Iii. naming of class and ID

Today in the project, I found a member of the code, the most outside called content, and then inside a Div, called content1, and then content1 inside called Content2, I do not know what to say, this call who can read? When we name a little bit of meaning, you say you do not understand English, then you use Pinyin to name also than you Content1,content2 good?

For a personal point of view and for better code writing, please follow me. Web Front End-Hebei

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.