{"id":1290,"date":"2025-02-03T18:09:50","date_gmt":"2025-02-03T10:09:50","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=1290"},"modified":"2025-02-03T18:09:51","modified_gmt":"2025-02-03T10:09:51","slug":"html-%e8%b0%83%e8%af%95%e4%b8%8e%e4%bc%98%e5%8c%96%e6%8a%80%e5%b7%a7%ef%bc%9a%e6%8f%90%e5%8d%87%e7%bd%91%e9%a1%b5%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/02\/03\/html-%e8%b0%83%e8%af%95%e4%b8%8e%e4%bc%98%e5%8c%96%e6%8a%80%e5%b7%a7%ef%bc%9a%e6%8f%90%e5%8d%87%e7%bd%91%e9%a1%b5%e6%80%a7%e8%83%bd\/","title":{"rendered":"HTML \u8c03\u8bd5\u4e0e\u4f18\u5316\u6280\u5de7\uff1a\u63d0\u5347\u7f51\u9875\u6027\u80fd"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728\u5f00\u53d1 HTML \u7f51\u9875\u65f6\uff0c\u8c03\u8bd5\u548c\u4f18\u5316\u662f\u786e\u4fdd\u7f51\u9875\u9ad8\u6548\u8fd0\u884c\u3001\u517c\u5bb9\u5404\u79cd\u8bbe\u5907\u5e76\u4e14\u6613\u4e8e\u7ef4\u62a4\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u672c\u8282\u5c06\u4ecb\u7ecd\u5e38\u89c1\u7684 HTML \u8c03\u8bd5\u5de5\u5177\u3001\u6027\u80fd\u4f18\u5316\u6280\u5de7\u4ee5\u53ca\u5982\u4f55\u5b9e\u73b0\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u548c\u517c\u5bb9\u79fb\u52a8\u8bbe\u5907\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. \u5e38\u89c1 HTML \u8c03\u8bd5\u5de5\u5177<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u8c03\u8bd5 HTML \u4ee3\u7801\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u53d1\u73b0\u548c\u89e3\u51b3\u95ee\u9898\u3002\u73b0\u4ee3\u6d4f\u89c8\u5668\u63d0\u4f9b\u4e86\u8bb8\u591a\u8c03\u8bd5\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u6211\u4eec\u68c0\u67e5\u3001\u4fee\u6539\u548c\u8c03\u8bd5 HTML \u9875\u9762\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u5de5\u5177\uff08DevTools\uff09<\/strong>\uff1a<br>\u5927\u591a\u6570\u73b0\u4ee3\u6d4f\u89c8\u5668\uff08\u5982 Google Chrome\u3001Firefox \u548c Safari\uff09\u90fd\u81ea\u5e26\u5f00\u53d1\u8005\u5de5\u5177\uff0c\u53ef\u4ee5\u7528\u6765\u8c03\u8bd5 HTML \u9875\u9762\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u53f3\u952e\u70b9\u51fb\u7f51\u9875\u5e76\u9009\u62e9 &#8220;\u68c0\u67e5&#8221; \u6216\u8005\u6309 <code>F12<\/code> \u6253\u5f00\u5f00\u53d1\u8005\u5de5\u5177\u3002 <strong>\u529f\u80fd<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>\u5143\u7d20\u9762\u677f\uff08Elements\uff09<\/strong>\uff1a\u67e5\u770b\u548c\u7f16\u8f91 HTML \u7ed3\u6784\uff0c\u53ef\u4ee5\u5b9e\u65f6\u4fee\u6539\u9875\u9762\u5143\u7d20\u3002<\/li>\n\n\n\n<li><strong>\u63a7\u5236\u53f0\u9762\u677f\uff08Console\uff09<\/strong>\uff1a\u67e5\u770b JavaScript \u9519\u8bef\u3001\u8b66\u544a\u548c\u65e5\u5fd7\u4fe1\u606f\u3002<\/li>\n\n\n\n<li><strong>\u7f51\u7edc\u9762\u677f\uff08Network\uff09<\/strong>\uff1a\u68c0\u67e5\u7f51\u9875\u7684\u8d44\u6e90\u52a0\u8f7d\u60c5\u51b5\uff0c\u5982\u56fe\u7247\u3001CSS \u6587\u4ef6\u548c JavaScript \u6587\u4ef6\u7b49\u3002<\/li>\n\n\n\n<li><strong>\u6027\u80fd\u9762\u677f\uff08Performance\uff09<\/strong>\uff1a\u67e5\u770b\u9875\u9762\u52a0\u8f7d\u65f6\u95f4\u3001\u811a\u672c\u6267\u884c\u7b49\u6027\u80fd\u4fe1\u606f\uff0c\u5e2e\u52a9\u8bca\u65ad\u6027\u80fd\u74f6\u9888\u3002<\/li>\n\n\n\n<li><strong>HTML \u9a8c\u8bc1\u5de5\u5177<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>W3C HTML \u9a8c\u8bc1\u5668<\/strong>\uff1aW3C \u63d0\u4f9b\u7684 HTML \u9a8c\u8bc1\u5668\u53ef\u4ee5\u68c0\u6d4b\u9875\u9762\u4e2d\u7684 HTML \u662f\u5426\u7b26\u5408\u6807\u51c6\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u53d1\u73b0\u6f5c\u5728\u7684\u8bed\u6cd5\u9519\u8bef\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. \u6027\u80fd\u4f18\u5316<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u6027\u80fd\u4f18\u5316\u5bf9\u4e8e\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u548c\u7f51\u9875\u52a0\u8f7d\u901f\u5ea6\u81f3\u5173\u91cd\u8981\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684 HTML \u6027\u80fd\u4f18\u5316\u6280\u5de7\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u56fe\u7247\u4f18\u5316<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>\u538b\u7f29\u56fe\u7247<\/strong>\uff1a\u4f7f\u7528\u5728\u7ebf\u5de5\u5177\u6216\u56fe\u50cf\u7f16\u8f91\u8f6f\u4ef6\u6765\u538b\u7f29\u56fe\u7247\u5927\u5c0f\uff0c\u51cf\u5c11\u9875\u9762\u52a0\u8f7d\u65f6\u95f4\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528\u9002\u5f53\u7684\u683c\u5f0f<\/strong>\uff1a\u9009\u62e9\u5408\u9002\u7684\u56fe\u7247\u683c\u5f0f\uff0cJPEG \u683c\u5f0f\u9002\u5408\u7167\u7247\uff0cPNG \u683c\u5f0f\u9002\u5408\u900f\u660e\u80cc\u666f\u56fe\uff0cWebP \u683c\u5f0f\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u538b\u7f29\u548c\u8d28\u91cf\u5e73\u8861\u3002<\/li>\n\n\n\n<li><strong>\u61d2\u52a0\u8f7d\u56fe\u7247<\/strong>\uff1a\u4f7f\u7528 <code>loading=\"lazy\"<\/code> \u5c5e\u6027\uff0c\u5ef6\u8fdf\u52a0\u8f7d\u4e0d\u5728\u89c6\u53e3\u5185\u7684\u56fe\u7247\uff0c\u76f4\u5230\u7528\u6237\u6eda\u52a8\u5230\u8be5\u533a\u57df\u65f6\u624d\u52a0\u8f7d\u3002 <strong>\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;img src=\"image.jpg\" alt=\"\u793a\u4f8b\u56fe\u7247\" loading=\"lazy\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u538b\u7f29 HTML \u6587\u4ef6<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>\u5220\u9664\u7a7a\u767d\u5b57\u7b26<\/strong>\uff1a\u901a\u8fc7\u538b\u7f29\u5de5\u5177\u5220\u9664 HTML \u6587\u4ef6\u4e2d\u7684\u7a7a\u683c\u3001\u6362\u884c\u7b26\u548c\u6ce8\u91ca\u7b49\u975e\u5fc5\u8981\u5b57\u7b26\uff0c\u51cf\u5c11\u6587\u4ef6\u5927\u5c0f\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528 Gzip \u538b\u7f29<\/strong>\uff1a\u542f\u7528\u670d\u52a1\u5668\u7aef\u7684 Gzip \u538b\u7f29\uff0c\u51cf\u5c11 HTML\u3001CSS \u548c JavaScript \u6587\u4ef6\u7684\u5927\u5c0f\u3002<\/li>\n\n\n\n<li><strong>\u5408\u5e76\u548c\u6700\u5c0f\u5316\u8d44\u6e90\u6587\u4ef6<\/strong>\uff1a<\/li>\n\n\n\n<li><strong>\u5408\u5e76\u591a\u4e2a CSS \u6216 JavaScript \u6587\u4ef6<\/strong>\uff1a\u5c06\u591a\u4e2a CSS \u6216 JavaScript \u6587\u4ef6\u5408\u5e76\u6210\u4e00\u4e2a\u6587\u4ef6\uff0c\u51cf\u5c11 HTTP \u8bf7\u6c42\u7684\u6570\u91cf\u3002<\/li>\n\n\n\n<li><strong>\u6700\u5c0f\u5316\u6587\u4ef6<\/strong>\uff1a\u4f7f\u7528\u5de5\u5177\uff08\u5982 UglifyJS\uff09\u6700\u5c0f\u5316 JavaScript \u6587\u4ef6\uff0c\u53bb\u6389\u7a7a\u683c\u3001\u6ce8\u91ca\u548c\u4e0d\u5fc5\u8981\u7684\u5b57\u7b26\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528 CDN\uff08\u5185\u5bb9\u5206\u53d1\u7f51\u7edc\uff09<\/strong>\uff1a<\/li>\n\n\n\n<li>\u5c06\u7f51\u7ad9\u7684\u9759\u6001\u8d44\u6e90\uff08\u5982\u56fe\u7247\u3001CSS \u548c JavaScript \u6587\u4ef6\uff09\u6258\u7ba1\u5230 CDN \u4e0a\uff0c\u5229\u7528 CDN \u63d0\u4f9b\u7684\u5168\u7403\u8282\u70b9\u52a0\u901f\u8d44\u6e90\u52a0\u8f7d\u901f\u5ea6\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>3. \u54cd\u5e94\u5f0f\u8bbe\u8ba1\u548c\u79fb\u52a8\u8bbe\u5907\u517c\u5bb9\u6027<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u662f\u786e\u4fdd\u7f51\u9875\u5728\u5404\u79cd\u8bbe\u5907\u4e0a\uff08\u5305\u62ec\u684c\u9762\u3001\u5e73\u677f\u548c\u624b\u673a\uff09\u90fd\u80fd\u826f\u597d\u663e\u793a\u7684\u6280\u672f\u3002\u901a\u8fc7 CSS \u5a92\u4f53\u67e5\u8be2\u548c\u7075\u6d3b\u7684\u5e03\u5c40\uff0c\u7f51\u9875\u53ef\u4ee5\u6839\u636e\u8bbe\u5907\u7684\u4e0d\u540c\u5c4f\u5e55\u5c3a\u5bf8\u548c\u5206\u8fa8\u7387\u81ea\u52a8\u8c03\u6574\u5e03\u5c40\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4f7f\u7528\u5a92\u4f53\u67e5\u8be2\uff08Media Queries\uff09<\/strong>\uff1a<br>\u5a92\u4f53\u67e5\u8be2\u5141\u8bb8\u6839\u636e\u8bbe\u5907\u7684\u5c4f\u5e55\u5bbd\u5ea6\u3001\u5206\u8fa8\u7387\u7b49\u6761\u4ef6\u5e94\u7528\u4e0d\u540c\u7684 CSS \u6837\u5f0f\uff0c\u4ece\u800c\u5b9e\u73b0\u54cd\u5e94\u5f0f\u5e03\u5c40\u3002 <strong>\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/* \u9488\u5bf9\u5c4f\u5e55\u5bbd\u5ea6\u5927\u4e8e 768px \u7684\u8bbe\u5907 *\/\n  @media screen and (min-width: 768px) {\n      body {\n          background-color: lightblue;\n      }\n  }\n\n  \/* \u9488\u5bf9\u5c4f\u5e55\u5bbd\u5ea6\u5c0f\u4e8e\u6216\u7b49\u4e8e 768px \u7684\u8bbe\u5907 *\/\n  @media screen and (max-width: 768px) {\n      body {\n          background-color: lightgreen;\n      }\n  }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6d41\u5f0f\u5e03\u5c40\uff08Fluid Layout\uff09<\/strong>\uff1a<br>\u4f7f\u7528\u767e\u5206\u6bd4\u6765\u5b9a\u4e49\u5143\u7d20\u7684\u5bbd\u5ea6\uff0c\u800c\u4e0d\u662f\u56fa\u5b9a\u7684\u50cf\u7d20\u503c\uff0c\u8fd9\u6837\u53ef\u4ee5\u8ba9\u7f51\u9875\u6839\u636e\u5c4f\u5e55\u5927\u5c0f\u81ea\u52a8\u8c03\u6574\u5e03\u5c40\u3002 <strong>\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  .container {\n      width: 100%;\n      padding: 10px;\n  }<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u89c6\u53e3\u8bbe\u7f6e\uff08Viewport\uff09<\/strong>\uff1a<br>\u5728 HTML \u9875\u9762\u4e2d\u4f7f\u7528 <code>&lt;meta><\/code> \u6807\u7b7e\u8bbe\u7f6e\u89c6\u53e3\uff08viewport\uff09\u5bbd\u5ea6\uff0c\u4ee5\u786e\u4fdd\u9875\u9762\u5728\u79fb\u52a8\u8bbe\u5907\u4e0a\u7684\u663e\u793a\u6548\u679c\u6b63\u786e\u3002 <strong>\u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>width=device-width<\/code>\uff1a\u786e\u4fdd\u9875\u9762\u5bbd\u5ea6\u4e0e\u8bbe\u5907\u5c4f\u5e55\u5bbd\u5ea6\u4e00\u81f4\u3002<\/li>\n\n\n\n<li><code>initial-scale=1.0<\/code>\uff1a\u8bbe\u7f6e\u521d\u59cb\u7f29\u653e\u6bd4\u4f8b\u3002<\/li>\n\n\n\n<li><strong>\u5f39\u6027\u5e03\u5c40\uff08Flexbox\uff09\u548c\u7f51\u683c\u5e03\u5c40\uff08Grid\uff09<\/strong>\uff1a<br>\u4f7f\u7528 CSS Flexbox \u548c Grid \u5e03\u5c40\u7cfb\u7edf\u53ef\u4ee5\u8f7b\u677e\u5b9e\u73b0\u54cd\u5e94\u5f0f\u8bbe\u8ba1\uff0c\u9002\u914d\u5404\u79cd\u5c4f\u5e55\u5c3a\u5bf8\u3002 <strong>Flexbox \u793a\u4f8b<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  .container {\n      display: flex;\n      flex-wrap: wrap;\n  }\n\n  .item {\n      flex: 1;\n      margin: 10px;\n  }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Grid \u793a\u4f8b<\/strong>\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  .container {\n      display: grid;\n      grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));\n  }<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u603b\u7ed3<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">HTML \u8c03\u8bd5\u4e0e\u4f18\u5316\u662f\u63d0\u5347\u7f51\u9875\u6027\u80fd\u3001\u7528\u6237\u4f53\u9a8c\u548c\u517c\u5bb9\u6027\u7684\u5173\u952e\u3002\u901a\u8fc7\u5408\u7406\u4f7f\u7528\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u5de5\u5177\u8c03\u8bd5 HTML\u3001\u538b\u7f29\u56fe\u7247\u3001\u4f18\u5316\u8d44\u6e90\u6587\u4ef6\u548c\u91c7\u7528\u54cd\u5e94\u5f0f\u8bbe\u8ba1\u7b49\u6280\u5de7\uff0c\u5f00\u53d1\u8005\u80fd\u591f\u663e\u8457\u63d0\u9ad8\u7f51\u9875\u7684\u52a0\u8f7d\u901f\u5ea6\u548c\u9002\u914d\u4e0d\u540c\u8bbe\u5907\u7684\u80fd\u529b\u3002\u638c\u63e1\u8fd9\u4e9b\u4f18\u5316\u65b9\u6cd5\u4e0d\u4ec5\u6709\u52a9\u4e8e\u63d0\u9ad8\u7f51\u7ad9\u7684\u6027\u80fd\uff0c\u8fd8\u80fd\u786e\u4fdd\u7f51\u9875\u5728\u5404\u79cd\u8bbe\u5907\u548c\u6d4f\u89c8\u5668\u4e0a\u826f\u597d\u8fd0\u884c\uff0c\u4ece\u800c\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5f00\u53d1 HTML \u7f51\u9875\u65f6\uff0c\u8c03\u8bd5\u548c\u4f18\u5316\u662f\u786e\u4fdd\u7f51\u9875\u9ad8\u6548\u8fd0\u884c\u3001\u517c\u5bb9\u5404\u79cd\u8bbe\u5907\u5e76\u4e14\u6613\u4e8e\u7ef4\u62a4\u7684\u91cd\u8981\u6b65\u9aa4\u3002\u672c\u8282\u5c06\u4ecb\u7ecd\u5e38\u89c1\u7684  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-1290","post","type-post","status-publish","format-standard","hentry","category-html"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1290","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=1290"}],"version-history":[{"count":2,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1290\/revisions"}],"predecessor-version":[{"id":1306,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/1290\/revisions\/1306"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=1290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=1290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=1290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}