What are the tags and common rules in HTML5? Introduction to HTML5 tags and rules

Source: Internet
Author: User
Tags lowercase
This article introduces you to what are the tags and common rules in HTML5? HTML5 label and the introduction of rules, there is a certain reference value, the need for friends can refer to, I hope to help you.

1. Naming rules
[Mandatory]class: Must be the word full letter lowercase, the word between-delimited, and must represent the corresponding module or part of the content or function, not to be named in the HTML built-in style, naming should have clear semantics.
[Mandatory]id: The uniqueness of the page must be maintained, and the naming should have explicit semantics.

2. Tags
Force Tag names in HTML must use lowercase letters.
[mandatory] The closure of the label to comply with the provisions of HTML5.
The use of the [mandatory] label must conform to the nested rules of the label, for example: P must not be placed in P, tbody have to be placed in the table.
The use of the label must follow the semantics of the label, for example:
P-Paragraph
h1,h2,h3,h4,h5,h6-level headings
Strong,em-Emphasis
INS-inserting
Del-Delete
ABBR-Abbreviation
Code-ID
Cite-Quote the title of the source work
Q-Reference
BLOCKQUOTE-A paragraph or lengthy reference
UL-unordered list
OL-Ordered list
DL,DT,DD-Definition List
[Recommended] You should not use a table to lay out your CSS when you can achieve the same requirements.

3. Properties
The Force property must be in lowercase letters and its property values must be surrounded by double quotation marks.
Suggestions for Boolean types do not add property values. Custom attributes are recommended to be prefixed with xxx-, data-is recommended

4. DOCTYPE
[Force] using DOCTYPE to enable standard mode, it is recommended to use uppercase DOCTYPE

5. Language encoding
[Recommended] to help improve the accessibility of the page, you must set the correct lang attribute, for example: The [mandatory] page must specify a character-encoded meta, and must be the first direct child of the head, for example: <metacharset= "UTF-8" >.

6. CSS and JavaScript introduction
[Mandatory] The introduction of CSS must indicate the rel= "stylesheet", when introducing CSS and JavaScript must indicate the Type property.
Recommendations JavaScript code must be placed at the end of the page or loaded asynchronously.

7. Head Content
Force The title tag must be set to the immediate child element of head and immediately after the CharSet declaration.
Force Favicon Guaranteed Accessibility, Example: <linkrel= "shortcut icon" href= "Path/favicon.ico" >
Force The viewport property must be specified.

8. Picture
[Force] to prohibit the IMG src value is empty, deferred loading of the picture also to increase the default SRC attribute value.
[Recommended] Important images add ALT attribute values.
[Recommended] Add the width and Height properties to avoid page jitter.

9. Control title
The control of the [force] text caption must be associated with its title using a label label, for example:

<label><input type= "checkbox" name= "Confirm" value= "on" > I have confirmed the above terms </label> or <labelfor= "user" > User: </label><inputtype= "text" name= "user" id= "user" >

10. Button
[force] must indicate the Type property value when using the button element

11. Accessibility
[Recommended] When you use JavaScript for form submission, you should make the native commit feature work correctly.
[Recommended] Specify the Type property of the input box based on the content type, for example: <input type= "Date" >

12. Multimedia
[Recommended] When you use audio and video tags to play the sound, videos, you should pay attention to the format:
Audio format: MP3, WAV, Ogg
Video format: MP4, WebM, Ogg

13. Notes

[Force] CSS, JavaScript code for a page or module must be commented in detail

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.