1.文件–>首选项–>用户片段;
2.选择HTML,生成html.json代码
3.代码模板(需要可以修改)
{
"h5 template": {
"prefix": "vh", // 对应的是使用这个模板的快捷键
"body": [
"<!DOCTYPE html>",
"<html lang=\"en\">",
"<head>",
"\t<meta charset=\"UTF-8\">",
"\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">",
"\t<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">",
"\t<title>Document</title>",
"<style>",
"\t.box {",
"\t\tposition: absolute;",
"\t\ttop: 50px;",
"\t\tleft: 50px;",
"\t\twidth: 150px;",
"\t\theight: 150px;",
"\t\tbackground-color: #f00;",
"\t}",
"</style>",
"<script src=\"\"></script>",
"</head>",
"<body>",
"\t<div class =\"box\"></div>\n",
"\t<script type=\"text/javascript\">\n",
"\t</script>",
"</body>",
"</html>"
],
"description": "HT-H5" // 模板的描述
}
}
4.转义字符
- 空格就是单纯的空格,输入空格就显示空格
- \t Tab键 横跳到下一制表符位置
- \n 回车换行
- ‘’ 双引号的单边’’