In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you what are the relevant knowledge points about the rules commonly used in HTML5, the content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
1. Naming rules
[mandatory] class: words must be lowercase, separated by -, and must represent the content or function of the corresponding module or part. They must not be named in the built-in style of html. Naming should have clear semantics.
[mandatory] id: must be unique in the page, naming should have clear semantics.
two。 Label
[mandatory] tags in Html must be in lowercase letters.
[mandatory] the closing of the label should comply with the regulations of html5.
[mandatory] the use of tags must comply with the nesting rules of tags, for example: P must not be placed in p, and tbody must be placed in table.
[suggestion] the use of tags must follow the semantics of tags, for example:
P-paragraph
H _ 2 ~ 2, h _ 3, h _ 4, h _ 5, h _ 6, h _ 7-level title.
Strong,em-emphasize
Ins-insert
Del-Delet
Abbr-acronym
Code-Code identification
Cite-quote the title of the source work
Q-citation
Blockquote-A paragraph or a long quote
Ul-unordered list
Ol-ordered list
Dl,dt,dd-definition list
[recommended] tables should not be used for layout when CSS can achieve the same requirements.
3. Attribute
[mandatory] attributes must be in lowercase letters and their values must be enclosed in double quotation marks.
[recommendation] it is recommended that attribute values are not added for Boolean types. Custom attributes are recommended to be prefixed with xxx-, and data- is recommended.
4. DOCTYPE
[force] use doctype to enable standard mode. Uppercase DOCTYPE is recommended.
5. Language coding
[suggestion] to help improve the accessibility of the page, you must set the correct lang attribute, for example:
[mandatory] the page must specify the meta of the character encoding and must be the first direct child element of the head, for example:.
6. Introduction of CSS and JavaScript
[mandatory] rel= "stylesheet" must be specified when css is introduced, and type attribute must be specified when css and javascript are introduced.
[recommended] Javascript code must be placed at the end of the page or loaded asynchronously.
7. Head content
[mandatory] the Title tag must be set to a direct child of head, immediately after the charset declaration.
[mandatory] Favicon guarantees accessibility, for example:
[mandatory] Viewport attribute must be specified.
8. Picture
[force] the src value of img is forbidden to be empty, and delayed loading images should also increase the default src attribute value.
[suggestion] add alt attribute value to important pictures.
[recommended] add width and height attributes to avoid page jitter.
9. Control title
[mandatory] controls with text titles must use label tags to associate them with their titles, for example, I have confirmed the above terms or users:
10. Button
[mandatory] the type attribute value must be specified when using the button element
11. Accessibility
[recommended] when using JavaScript for form submission, the native submission function should be made to work properly.
[recommended] specify the type attribute of the input box according to the content type, for example:
twelve。 Multimedia
[recommended] when using audio and video tags to play audio and video, you should pay attention to the format:
Audio format: MP3, WAV, Ogg
Video format: MP4, WebM, Ogg
13. Annotation
[mandatory] detailed comments must be made on the CSS and javascript code of the page or module
These are all the contents of the article "what are the rules commonly used in HTML5?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.