[Front-end] #001 coding specification,

Source: Internet
Author: User

[Front-end] #001 coding specification,

 

HTML encoding style:

Document Type:HTML5 type

<!doctype html>
Encoding:Set the encoding type UTF-8 using meta
<!doctype html>
  
     <metacharset="utf-8">
  
  <body>
  </body>
Case sensitivity:Except for the Text CDATA element, lowercase is used for all other elements.
 
Indent:The entire file should be unified (depending on the situation, use 2 or 4 spaces)
 
Line feed: displays block-level elements (div, p), list elements (ul, ol), table elements (table) line feed, line feed of line elements greater than 80
 
Programming style
<! -- Not recommended->
<linkrel="stylesheet"href="//www.google.com/css/maia.css"type="text/css">
<! -- Recommendation->
<linkrel="stylesheet"href="//www.google.com/css/maia.css">
<! -- Not recommended->
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"type="text/javascript"></script>
<! -- Recommendation->
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"></script>

6. The button label is preferred, instead of the <input type = "button" title = "button"/>

7. The title attribute must be set for html tags.

 

CSS development specifications

/* Not recommended */h3 {font-weight: bold ;}
/* Recommended */h3 {font-weight: bold ;}
/* Not recommended */a: focus, a: active {position: relative; top: 1px;}/* Recommended */h1, h2, h3 {font-weight: normal; line-height: 1.2 ;}
 

Writing Sequence

Css should be written in the following order, in principle:Positioning layout first, followed by details

 

Z-index usage Specification

In principle, the use of the module css must follow the following rules, but it is not enforced. In the development process, you should use the layout manager to manage the layout.

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.