{"id":230756,"date":"2024-05-11T22:01:58","date_gmt":"2024-05-11T14:01:58","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/230756.html"},"modified":"2024-05-11T22:02:08","modified_gmt":"2024-05-11T14:02:08","slug":"%e6%80%8e%e4%b9%88%e7%94%a8vscode%e8%bf%90%e8%a1%8chtml%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/230756.html","title":{"rendered":"\u600e\u4e48\u7528VScode\u8fd0\u884chtml\u4ee3\u7801"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25153318\/aef44063-c9bf-4d9c-b3ee-e7f1b9370071.webp\" alt=\"\u600e\u4e48\u7528VScode\u8fd0\u884chtml\u4ee3\u7801\" \/><\/p>\n<p><p>\u8981\u7528VSCode\u8fd0\u884cHTML\u4ee3\u7801\uff0c\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a<strong>\u5b89\u88c5VSCode\u3001\u5b89\u88c5Live Server\u63d2\u4ef6\u3001\u7f16\u5199HTML\u4ee3\u7801\u3001\u901a\u8fc7Live Server\u8fd0\u884cHTML\u4ee3\u7801<\/strong>\u3002\u5bf9\u4e8e\u521d\u5b66\u8005\u6765\u8bf4\uff0c<strong>\u5b89\u88c5Live Server\u63d2\u4ef6<\/strong>\u662f\u975e\u5e38\u5173\u952e\u7684\u4e00\u6b65\uff0c\u56e0\u4e3a\u5b83\u80fd\u8ba9\u5f00\u53d1\u8005\u5b9e\u65f6\u9884\u89c8\u7f51\u9875\uff0c\u800c\u4e0d\u9700\u8981\u624b\u52a8\u5237\u65b0\u6d4f\u89c8\u5668\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u5b89\u88c5VSCode<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4ece\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5Visual Studio Code\uff08VSCode\uff09\u3002VSCode\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u4f46\u5f3a\u5927\u7684\u6e90\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\uff0c\u6709\u7740\u4e30\u5bcc\u7684\u6269\u5c55\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00VSCode\uff0c\u901a\u8fc7\u7b80\u6d01\u7684\u754c\u9762\u53ef\u4ee5\u8f7b\u677e\u5f00\u59cb\u4f60\u7684\u7f16\u7a0b\u4e4b\u65c5\u3002VSCode\u63d0\u4f9b\u4e86\u4e00\u4e2a\u76f4\u89c2\u7684\u7528\u6237\u754c\u9762\u548c\u4e00\u4e2a\u547d\u4ee4\u9762\u677f\uff0c\u53ef\u4ee5\u8f7b\u677e\u8bbf\u95ee\u5404\u79cd\u529f\u80fd\u548c\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5b89\u88c5Live Server\u63d2\u4ef6<\/h3>\n<\/p>\n<ol>\n<li>\n<p>\u5b89\u88c5Live Server\u63d2\u4ef6\u5bf9\u4e8e\u524d\u7aef\u5f00\u53d1\u8005\u6765\u8bf4\u81f3\u5173\u91cd\u8981\uff0c\u5b83\u53ef\u4ee5\u8ba9\u4f60\u7684HTML\u3001CSS\u548cJavaScript\u4ee3\u7801\u5728\u5b9e\u65f6\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u540c\u65f6\u63d0\u4f9b\u5b9e\u65f6\u6d4f\u89c8\u5668\u5237\u65b0\u529f\u80fd\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u5728VSCode\u4e2d\u5b89\u88c5Live Server\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\u6253\u5f00\u6269\u5c55\u89c6\u56fe\u901a\u8fc7\u70b9\u51fb\u5de6\u4fa7\u7684\u6269\u5c55\u56fe\u6807\u6216\u4f7f\u7528\u5feb\u6377\u952eCtrl+Shift+X\u3002\u7136\u540e\u5728\u641c\u7d22\u6846\u4e2d\u8f93\u5165\u201cLive Server\u201d\uff0c\u627e\u5230Live Server\u6269\u5c55\u5e76\u70b9\u51fb\u5b89\u88c5\u3002\u5b89\u88c5\u5b8c\u6210\u540e\u5c31\u53ef\u4ee5\u5728\u4f60\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u8fd9\u4e2a\u5f3a\u5927\u7684\u5de5\u5177\u4e86\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u7f16\u5199HTML\u4ee3\u7801<\/h3>\n<\/p>\n<ol>\n<li>\n<p>\u521b\u5efa\u6216\u6253\u5f00\u4f60\u7684HTML\u6587\u4ef6\u662f\u5f00\u59cb\u7f16\u7801\u7684\u7b2c\u4e00\u6b65\u3002\u5728VSCode\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u6587\u4ef6\u83dc\u5355\u65b0\u5efa\u6587\u4ef6\uff0c\u4fdd\u5b58\u65f6\u4f7f\u7528.html\u6269\u5c55\u540d\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528HTML\u6807\u7b7e\u5f00\u59cb\u7f16\u5199\u4f60\u7684\u7f51\u9875\u7ed3\u6784\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>&lt;html&gt;\u3001&lt;head&gt;\u3001&lt;body&gt;<\/code>\u7b49\u6807\u7b7e\u5b9a\u4e49\u7f51\u9875\u7684\u57fa\u672c\u7ed3\u6784\u3002\u7136\u540e\uff0c\u53ef\u4ee5\u6dfb\u52a0\u5176\u4ed6\u5143\u7d20\u5982<code>&lt;p&gt;<\/code>\u7528\u4e8e\u6bb5\u843d\u3001<code>&lt;h1&gt;<\/code>\u5230<code>&lt;h6&gt;<\/code>\u7528\u4e8e\u6807\u9898\u548c<code>&lt;a&gt;<\/code>\u7528\u4e8e\u94fe\u63a5\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u901a\u8fc7Live Server\u8fd0\u884cHTML\u4ee3\u7801<\/h3>\n<\/p>\n<ol>\n<li>\n<p>\u4ee3\u7801\u7f16\u5199\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7Live Server\u6765\u9884\u89c8\u4f60\u7684\u7f51\u9875\u3002\u53ea\u9700\u53f3\u952e\u70b9\u51fbHTML\u6587\u4ef6\u5e76\u9009\u62e9\u201cOpen with Live Server\u201d\uff0c\u6216\u8005\u70b9\u51fb\u5e95\u90e8\u72b6\u6001\u680f\u7684\u201cGo Live\u201d\u6309\u94ae\uff0c\u4f60\u7684\u9ed8\u8ba4\u7f51\u9875\u6d4f\u89c8\u5668\u5c31\u4f1a\u542f\u52a8\u5e76\u663e\u793a\u4f60\u7684\u7f51\u9875\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>Live Server\u7684\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u5b83\u63d0\u4f9b\u5b9e\u65f6\u9884\u89c8\u529f\u80fd\u3002\u6bcf\u6b21\u4f60\u4fdd\u5b58\u6587\u4ef6\u65f6\uff0c\u7f51\u9875\u4f1a\u81ea\u52a8\u5237\u65b0\u5e76\u663e\u793a\u6700\u65b0\u7684\u5185\u5bb9\u3002\u8fd9\u4f7f\u5f97\u5f00\u53d1\u8fc7\u7a0b\u66f4\u52a0\u9ad8\u6548\u548c\u76f4\u89c2\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5728VSCode\u4e2d\u8fd0\u884cHTML\u4ee3\u7801\uff0c\u5e76\u5b9e\u65f6\u9884\u89c8\u4f60\u7684\u7f51\u9875\u3002\u8fd9\u4e0d\u4ec5\u63d0\u9ad8\u4e86\u5f00\u53d1\u6548\u7387\uff0c\u4e5f\u4f7f\u5f97\u8c03\u8bd5\u8fc7\u7a0b\u53d8\u5f97\u7b80\u5355\u8bb8\u591a\u3002\u52a0\u4e0aVSCode\u4e30\u5bcc\u7684\u6269\u5c55\u5e93\u548c\u53cb\u597d\u7684\u7528\u6237\u754c\u9762\uff0c\u65e0\u8bba\u4f60\u662f\u521d\u5b66\u8005\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\uff0c\u90fd\u80fd\u5728\u524d\u7aef\u5f00\u53d1\u4e2d\u83b7\u76ca\u532a\u6d45\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u6211\u8be5\u5982\u4f55\u5728VScode\u4e2d\u8fd0\u884cHTML\u4ee3\u7801\uff1f<\/strong><br \/>\n\u5728VScode\u4e2d\u8fd0\u884cHTML\u4ee3\u7801\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u6253\u5f00VScode\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\uff0c\u5c06HTML\u4ee3\u7801\u7c98\u8d34\u5230\u5176\u4e2d\u3002\u7136\u540e\uff0c\u4f7f\u7528\u5feb\u6377\u952eCtrl + Shift + P\uff08Windows\uff09\u6216Cmd + Shift + P\uff08Mac\uff09\u6253\u5f00\u547d\u4ee4\u9762\u677f\u3002\u5728\u547d\u4ee4\u9762\u677f\u4e2d\uff0c\u8f93\u5165&quot;Open with Live Server&quot;\u5e76\u9009\u62e9\u8be5\u9009\u9879\u3002\u8fd9\u5c06\u8fd0\u884c\u4e00\u4e2a\u672c\u5730\u670d\u52a1\u5668\uff0c\u5e76\u5728\u9ed8\u8ba4\u7684\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00\u4f60\u7684HTML\u6587\u4ef6\uff0c\u4f60\u5c06\u80fd\u591f\u5b9e\u65f6\u67e5\u770b\u548c\u8c03\u8bd5\u4f60\u7684\u9875\u9762\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u5728VScode\u4e2d\u914d\u7f6e\u8c03\u8bd5\u6a21\u5f0f\u6765\u8fd0\u884cHTML\u4ee3\u7801\uff1f<\/strong><br \/>\n\u5728VScode\u4e2d\u914d\u7f6e\u8c03\u8bd5\u6a21\u5f0f\u6765\u8fd0\u884cHTML\u4ee3\u7801\u4e5f\u662f\u5f88\u7b80\u5355\u7684\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86Debugger for Chrome\u6269\u5c55\u3002\u7136\u540e\uff0c\u5728VScode\u7684\u5de6\u4fa7\u8fb9\u680f\u4e2d\u70b9\u51fb\u8c03\u8bd5\u56fe\u6807\uff08\u4e00\u4e2a\u5c0f\u866b\u5b50\u7684\u56fe\u6807\uff09\uff0c\u7136\u540e\u70b9\u51fb\u9f7f\u8f6e\u56fe\u6807\uff0c\u9009\u62e9Chrome\u4f5c\u4e3a\u8c03\u8bd5\u914d\u7f6e\u7684\u73af\u5883\u3002\u63a5\u4e0b\u6765\uff0c\u5728VScode\u7684\u5de5\u4f5c\u533a\u4e2d\uff0c\u521b\u5efa\u4e00\u4e2a\u65b0\u6587\u4ef6\u5939\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>.vscode<\/code>\u7684\u65b0\u6587\u4ef6\u5939\u3002\u5728<code>.vscode<\/code>\u6587\u4ef6\u5939\u4e2d\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>launch.json<\/code>\u7684\u65b0\u6587\u4ef6\uff0c\u5e76\u5c06\u4ee5\u4e0b\u4ee3\u7801\u590d\u5236\u7c98\u8d34\u5230\u6587\u4ef6\u4e2d\uff1a<\/p>\n<pre><code>{\n    &quot;version&quot;: &quot;0.2.0&quot;,\n    &quot;configurations&quot;: [\n        {\n            &quot;type&quot;: &quot;chrome&quot;,\n            &quot;request&quot;: &quot;launch&quot;,\n            &quot;name&quot;: &quot;Launch Chrome ag<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>nst index.html&quot;,\n            &quot;file&quot;: &quot;${workspaceFolder}\/index.html&quot;\n        }\n    ]\n}\n<\/code><\/pre>\n<p>\u4fdd\u5b58<code>launch.json<\/code>\u6587\u4ef6\u540e\uff0c\u5c06\u7126\u70b9\u653e\u5728\u4f60\u7684HTML\u6587\u4ef6\u4e0a\uff0c\u7136\u540e\u70b9\u51fb\u8c03\u8bd5\u9762\u677f\u4e2d\u7684\u7eff\u8272\u64ad\u653e\u6309\u94ae\u6765\u542f\u52a8Chrome\u8c03\u8bd5\u5668\u5e76\u8fd0\u884c\u4f60\u7684HTML\u4ee3\u7801\u3002<\/p>\n<p><strong>3. \u9664\u4e86\u4f7f\u7528Live Server\u548c\u8c03\u8bd5\u6a21\u5f0f\uff0c\u8fd8\u6709\u5176\u4ed6\u65b9\u5f0f\u53ef\u4ee5\u5728VScode\u4e2d\u8fd0\u884cHTML\u4ee3\u7801\u5417\uff1f<\/strong><br \/>\n\u5f53\u7136\u53ef\u4ee5\u3002\u9664\u4e86Live Server\u548c\u8c03\u8bd5\u6a21\u5f0f\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528VScode\u63d0\u4f9b\u7684\u5176\u4ed6\u6269\u5c55\u6765\u8fd0\u884cHTML\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u5b89\u88c5\u5e76\u4f7f\u7528Code Runner\u6269\u5c55\uff0c\u8be5\u6269\u5c55\u5141\u8bb8\u4f60\u5728VScode\u4e2d\u76f4\u63a5\u8fd0\u884c\u4f60\u7684HTML\u6587\u4ef6\uff0c\u800c\u65e0\u9700\u989d\u5916\u914d\u7f6e\u3002\u53ea\u9700\u6309\u4e0bCtrl + Alt + N\uff08Windows\uff09\u6216Cmd + Option + N\uff08Mac\uff09\uff0cCode Runner\u5c06\u5728\u7ec8\u7aef\u7a97\u53e3\u4e2d\u540c\u65f6\u6253\u5f00\u4f60\u7684HTML\u6587\u4ef6\u548c\u7ed3\u679c\u3002\u8fd9\u662f\u4e00\u79cd\u5feb\u901f\u800c\u65b9\u4fbf\u7684\u8fd0\u884cHTML\u4ee3\u7801\u7684\u65b9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u8981\u7528VSCode\u8fd0\u884cHTML\u4ee3\u7801\uff0c\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\uff1a\u5b89\u88c5VSCode\u3001\u5b89\u88c5Live Server\u63d2\u4ef6\u3001\u7f16\u5199H [&hellip;]","protected":false},"author":3,"featured_media":230763,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/230756"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=230756"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/230756\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/230763"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=230756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=230756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=230756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}