Front End Specification 1-html specification

Source: Internet
Author: User

HTML Specification 1 Code style (reference 1,)Use the tab character (four space length) hierarchy too much to write in one line, but ensure that each line of code should not be too long, the code should not be too long

example, try to write in one line

2 naming (reference 1,)Class must use lowercase, use between words-instead of _ (underscore) to connect as semantically as possible (priority English and English abbreviations, followed by pinyin, re-use parts location, etc. (e.g. Con-left)) example ID must ensure that this page is uniquethe same page should avoid the same name and ID name (ie confusion), parameter 1Explanation: Compatibility issues with IE6 3 Label (reference 1,)reduce the number of labels as much as possible, while guaranteeing semantics and styleLabel name must use lowercase (example <p></p>)closed Label   Another discussion, Links:label usage must conform to tag nesting rulesAnother discussion, Links:HTML tags follow tag semanticsAnother discussion, Links:the use of labels is as concise as possible, reducing unnecessary labels, reducing levels, flattening 4 Property nameMust use a lowercase attribute value must use double quotation marks, instead of single quotes, parameter 1, custom properties suggest using xxx-as prefix, recommend using data-, parameter 1 order (parameter 1,ctrl+f: attribute order) ID class Name data-* SRC, for, Type,href Title,altAria-*,roleBoolean property of a Boolean value type (property value = = property), it is recommended not to add a property value to the existence of a Boolean attribute in an element that represents the value true, and does not exist to represent a value of false. Cases: 5head Internal Label (reference 1 General)Using <! DOCTYPE html>Use IE edge mode, parameter 1 (but not now, temporarily reserved)Recommended settings rel= "stylesheet" must be indicated when CSS is introduced, reference 1There is no need to specify the type attribute when introducing CSS and JS (because the indicated value is the default value)JS scripts are placed at the bottom of the page, or when introduced into CSS and JavaScript with asynchronous loading, you do not need to specify the type. Using Favicon, the browser defaults to requesting Favicon.ico under the Web server root directory, and must use one of the following methods 1. Place the Favicon.ico file in the Web server root 2. Using link          Specifies Favicon. <link rel= "shortcut icon" href= "Path/to/favicon.ico" >Viewport 6 NotesComment ends with a space, and ends with a backslash "close". Cases ImageProhibit img src is empty, delayed loading of the picture also has the default SRC to avoid adding unnecessary title attribute, for important pictures plus ALT attribute These two also have objections, another discussion, Link: Add weidth and Height properties, avoid page jitter The meaning of this should be that when the picture is not loaded and after the picture is loaded, the image size changes affect the page layout needs the user to download the picture using the IMG tag instead of using the background background image using Sprite diagram formControl title (<label> label)1. Place the control inside the label. (recommended)The for property of 2.label points to the ID of the control. Example:
Buttons using the button element must indicate the type attribute value (Submit and Cancel button) for increased accessibility important tag code should precede (for example, commit before reset), use style controlwhen a page is developed for a mobile device, the Type property of the input box is specified based on the content type. When a form submission is made using JavaScript, the native commit feature should work correctly if the conditions permit. MultimediaAudio: MP3, WAV, OGG Video: MP4, WebM, OGG priority to use audio and video tags to define the audio and video, and in the object tag indicates that the browser does not support the label description. Try not to play automatically. Templates

Front End Specification 1-html specification

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.