html规范
# html 规范
- 属性使用双引号
<img class="zoom-custom-imgs" class="img" alt="图片" data-index="1" />
1
- 语义化标签
<header>头部</header>
<nav>导航栏</nav>
<section>块</section>
<footer>尾部</footer>
1
2
3
4
2
3
4
- 单标签自闭合
<input type="text" />
<custom-tag />
1
2
2
- 自定义标签名,横杠
-
划分
<user-list></user-list>
1
img
需要写alt
<img class="zoom-custom-imgs" class="img" alt="图片" data-index="1" />
1
html
标签的lang
属性统一用zh-cmn-Hans
,简体中文
<html lang='zh-cmn-Hans'>
1
HTML lang 参考文章 (opens new window)
meta
设置
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="keywords" content="壁虎, 壁虎科技">
<meta name="description" content="壁虎科技打造的专业票据交易工具。">
1
2
3
4
5
2
3
4
5
- 元素层级换行并用两个空格缩进
<setion>
<div>
<span></span>
</div>
</setion>
1
2
3
4
5
2
3
4
5
- 操作符号前后加空格
<div>
{ data.num }
</div>
1
2
3
2
3
v-for
处加上key
<div v-for="" :key=""></div>
1
编辑 (opens new window)