HTML specification for front-end encoding style specifications-

Source: Internet
Author: User
Tags html validator w3c html validator
Generally, we recommend that you use HTML code that can pass standard validation unless you have to make concessions on performance optimization and file size control. HTML5 document type declaration is recommended for HTML standard document types :! DOCTYPEhtml. (We recommend that you use texthtml format ...,. Original article: Web Styleguide-Style guide to harmonize HTML, Javascript and CSS/SASS coding style

HTML Specification

Document Type

HTML5 document type statement is recommended:.

(Html in text/HTML format is recommended. Avoid using XHTML. XHTML and its attributes, such as application/xhtml + xml, have limited space for application support and Optimization in the browser ).

In HTML, it is better not to close tags with no content element [1]. For example, use
Rather
.

HTML Verification

Generally, we recommend that you use HTML code that can pass standard validation unless you have to make concessions on performance optimization and file size control.

Use tools such as W3C HTML validator for detection.

Standardized HTML is a significant quality baseline that shows technical requirements and limitations. It promotes better use of HTML.

Not recommended

  1. Test
  2. This is only a test.



Recommendation



  1. Test
  2. This is only a test.


Omit optional labels

The HTML5 specification specifies that HTML tags can be omitted. But in terms of readability, it is better not to do this in the development source file, because omitting tags may cause some problems.

Omitting some optional labels does reduce the page size, which is useful, especially for some large websites. To achieve this goal, we can compress the page at the end of development. In this step, these optional labels can be completely omitted.

Script Loading

For performance considerations, asynchronous Script Loading is critical. A script is placed inFor example
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.