Front-end specification 1-HTML specification, specification 1-HTML Specification

Source: Internet
Author: User

Front-end specification 1-HTML specification, specification 1-HTML Specification
HTML Specification1. Code style (parameter 1 ,)Use Tab characters (four spaces in length). When there are too many hierarchies, try to write them in one line, but make sure that each line of code should not be too long, for example, the Code should not be too long.

For example, try to write a line

2 Name (parameter 1 ,)The class must be in lower case, and words must be separated by hyphens (-) instead of underscores (_) to connect to semantics as much as possible (English letters and abbreviations are preferred, followed by pinyin, if you use the component location again (for example, con-left), the instance id must be unique on the same page. The name and id must be the same (IE obfuscation: compatibility issues with IE6 3 tag (parameter 1 ,)To minimize the number of tags, the tag name must be closed in lower case (for example, <p> </p>) When semantics and style are ensured: the use of tags must comply with Tag nesting rules. Link: HTML tags follow tag semantics. Link: use tags as concise as possible to reduce unnecessary tags, reduce hierarchy and flattening 4. attribute nameThe attribute values of lower-case letters must use double quotation marks instead of single quotation marks. Parameter 1. We recommend that you use xxx-as the prefix for custom attributes. data-is recommended, and parameter 1 is the order (parameter 1, ctrl + F: attribute order) id class name data-* src, for, type, href title, alt aria -*, A Boolean attribute of the role Boolean type (attribute value = attribute). We recommend that you do not add the attribute value. If the attribute value does not exist, the existence of the Boolean attribute in an element indicates that the value is true. If the attribute does not exist, the value is false. Example: 5 head Internal label (Common parameter 1)Use <! DOCTYPE html> use the IE Edge mode. Parameter 1 (this attribute is not available now and is retained temporarily) we recommend that you set 6. NotesUse spaces at both ends of the comment, and end the comment with a backslash "close ". Example ImageIf the src of img is prohibited to be empty, the default src attribute must be set for the delayed loading image to avoid unnecessary title attributes. The alt attribute for the important image also has objections, add the weidth and height attributes, to avoid page jitter, this means that when the image is not loaded and the image size changes after the image is loaded, the page layout will be affected. You need to use the img label for the image to be downloaded, instead of using the background image to use the sprite image. FormControl title (<label> label) 1. Place the control in the label. (Recommended) 2. The for Attribute of label points to the Control id. Example:
When using the button element, you must specify the type attribute value (submit and cancel button). The tag code that is important to improving accessibility should be in front (for example, submitting before resetting ), use style control to specify the type attribute of the input box based on the content type when developing pages for mobile devices. When using JavaScript For Form submission, the native submission function should work properly if conditions permit. 
MultimediaAudio: MP3, WAV, and Ogg videos: MP4, WebM, and Ogg use the audio and video tags to define audio and video first, and indicate the tags not supported by the browser in the object tag. Try not to play automatically. 
Template 

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.