Home >Web Front-end >HTML Tutorial >【Front-end】#001 Coding specification_html/css_WEB-ITnose
HTML coding style:
Document type: HTML5 type
<!doctype html>
<strong> 编码:</strong> 使用 meta 设置编码类型 UTF-8
<!doctype html>
<html>
<head>
<metacharset="utf-8">
</head>
<body>
</body>
</html>
<strong>大小写:</strong>除了 Text CDATA元素,其他都使用小写
<strong>缩进:</strong>整个文件要统一(具体看情况使用 2、4空格)
换行:出现块级元素(div、p),列表元素(ul,ol),表格元素(table) 换行,行内元素大于80换行
<strong>编程风格</strong>
<!-- 不推荐 ?>
<linkrel="stylesheet"href="//www.google.com/css/maia.css"type="text/css">
<!-- 推荐 ?>
<linkrel="stylesheet"href="//www.google.com/css/maia.css">
<!-- 不推荐 ?>
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"type="text/javascript"></script>
<!-- 推荐 ?>
<scriptsrc="//www.google.com/js/gweb/analytics/autotrack.js"></script>
6. Prioritize the use of button tags instead of 7fa4c5df29cac0c536723c0cd068ebe7
7. The html tag must set the title attribute
CSS development specifications
/* 不推荐 */h3{ font-weight:bold;}
/* 推荐 */h3 { font-weight: bold;}
/* 不推荐 */a:focus, a:active { position: relative; top: 1px; }/* 推荐 */h1,h2,h3 { font-weight: normal; line-height: 1.2;}
Writing order
css It should be written in the following order. The principle is positioning and layout first, details second
Z-index usage specifications
In principle, module css must comply with the following specifications when using absolute positioning, but it is not enforced. During the development process, use less absolute positioning layout and more use the layout manager to manage the layout.