1. Protocol Header:
It is recommended that you omit the Http:https: Protocol section from the URL address of a picture or other media file, style sheet, and script unless it is known that the corresponding file cannot be compatible with 2 protocols at the same time.
Note: This is true weekday, as long as the absolute address, http: always with. If you think about it, it makes sense.
2. Indent: Use double spaces for each indent
Do not indent by using the Tab tab or tab with a combination of spaces
3. Case: Use lowercase only
All code should be lowercase, including element names, attributes, attribute values (except for text or CDATA content), selectors, CSS properties, property values (except strings)
4. Trailing spaces
Trailing spaces are unnecessary and easy to complicate diff files. This is definitely a summary of lessons learned!!!
5. Encoding format: Using UTF-8
Make sure that your editor uses the character encoding?? Is UTF-8, there is no byte order mark. In an HTML template or document.
Defines the encoding format. About encoding formats Reference Character sets & encodings in XHTML, HTML and CSS
6. Notes
Explain the code as needed, this is not much to say, the team to develop this is very important, although many times people do not want to abide by, but it is really important!!!
7.TODO Pending items
The unfinished or pending content must be highlighted by the logo, using TODO identification, rather than others such as @@ 来
In the TODO item, if it is necessary to list the contact, such as the person responsible
Append a colon after Todo as action content, such as TODO: Add HTML5 template to Mei Rui Net
8. Document type: Using HTML5
Use. HTML (text/html) type file relative XHTML (alication/xhtml+xml) files are much better in browser and frame support and optimization space.
9.HTML Legitimacy Verification
Use HTML legally, and use the tools (HTML validator) to check. The only exception is that the file size needs to be compressed for performance reasons.
The original text is as follows: Use valid HTML code unless this is not possible due to otherwise unattainable performance goals regarding file size. But it's hard to imagine how many bytes of file size can be saved by omitting tags? But the problem is high risk!
10. Semantics
It is particularly important for HTML5 to use HTML appropriately for its purpose. The following examples can be compared to achieve the same results, but the efficiency and readability are very different.
For HTML5, for example, header, footer, nav, section, etc. are basically similar to the functions Div can achieve, but there is a great difference in semantics.
11. Multimedia Backup: Provide alternative content for multimedia
This is the content of Laosheng long talk, the typical is to add ALT content for IMG.
12. Separation of concerns
This is important, strictly adhering to the principle of separating the organizational structure (markup), presentation style (style) and behavioral action (script), and minimizing the association between the three. This is mainly based on maintenance considerations, usually, updating the style file or script file is much less expensive than changing the HTML file, imagine, for a site with more than 100,000 pages for local color adjustment, is it easy to modify each HTML file or modify a style file?
Optional Tags: omit optional labels
13. Entity references
Assuming the same encoding format (UTF-8) is used within the development team, the file and editor are not required to use entity references, such as-, ", or? Except for some characters in HTML that have a specific meaning, such as "<", or invisible words such as spaces
14.Type Properties: omitted
Omit the type from the style sheet and script, unless you are not using CSS or JavaScript, in HTML5, the value defaults to TEXT/CSS and Text/javascript
15.block,list or TABLE element
Another row for each block,list or table element, and indents before each child element. This is good readability.
HTML 5 Code specification