在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