在vscode中使用html模板


一、输入!+tab键,或者!+enter,自动生成html:5的模板

 

 二、自定义模板

打开File(文件)–>Preferences(首选项)–>User Snippets(用户片段)–>在文本框中输入“html”(将打开html.json,在该文件中输入对应的模板保存即可)–>在空白html文件中输入“h”+回车,即可生成自定义的模板、

 

 

 

 

 

{
    // Place your snippets for html here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    // same ids are connected.
    // Example:
    // "Print to console": {
    //     "prefix": "log",
    //     "body": [
    //         "console.log('$1');",
    //         "$2"
    //     ],
    //     "description": "Log output to console"
    // }
    "html template":{
        "prefix":"h",//使用模板的快捷键
        "body": [
            "<!DOCTYPE html>",
            "<html lang=\"en\">",
            "<head>",
            "\t<meta charset=\"UTF-8\">",
            "\t<title>Document</title>",
            "</head>",
            "<body>",
            "\t $0",//$0鼠标停留的位置
            "</body>",
            "</html>"
        ],
        "description": "html模板"//模板的描述
    }
}
html.json

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM