-
Notifications
You must be signed in to change notification settings - Fork 117
Dev.Coding Standard HTML
Taiwen Jiang edited this page Jul 13, 2013
·
13 revisions
- Refer to Google HTML/CSS Coding Standard for details.
- Following text is solely for Chinese explanation and might be incomplete or inappropriate.
- 文档声明
<!DOCTYPE HTML>
- tabsize 2个空格
<ul> <li>Fantastic <li>Great </ul>
-
html标签全部小写
-
注释:第一个单词首字母大写,冒号后面说明这一区域的主要内容是什么。
<!-- Header: sitename, user-link --> <!-- Navigation --> <!-- Footer: sitelink -->
- 实体参照
< < > > & & space
- 省略部分标签
<ul> <li> <li> </ul>
<dl> <dd> <dt> <dd> <dt> </dl>
<!-- p标签后面如果跟的是address, article, aside, blockquote, dir, div, dl, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, section, table, or ul,或者是最后一个子元素 --> <p> <div></div> <div> <p> </div>
<select> <option> <option> </select>
<table> <thead> <tr> <th> <th> <tbody> <tr> <td> <td> <tr> <td> <td> </table>
- 样式和脚本标签去掉
type
属性
<link rel="stylesheet" href="//www.google.com/css/maia.css"> <script src=""></script> <script> ... </script>
- 属性值都用双引号
<input type="text" class="input-small"> <img src="">
- 每一个区块,子元素都换行
<ul> <li>列表1 <li>列表2 </ul>