{"id":28122,"date":"2024-11-24T08:02:12","date_gmt":"2024-11-24T00:02:12","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28122\/"},"modified":"2024-11-24T08:02:12","modified_gmt":"2024-11-24T00:02:12","slug":"html%e4%b8%ad%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e5%ad%90%e5%ae%b9%e5%99%a8%e9%ab%98%e5%ba%a6%e7%ad%89%e4%ba%8e%e7%88%b6%e5%ae%b9%e5%99%a8%e9%ab%98%e5%ba%a6%ef%bc%8c%e4%b8%94%e5%ae%bd%e5%ba%a6","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28122\/","title":{"rendered":"HTML\u4e2d\u5982\u4f55\u5b9e\u73b0\u5b50\u5bb9\u5668\u9ad8\u5ea6\u7b49\u4e8e\u7236\u5bb9\u5668\u9ad8\u5ea6\uff0c\u4e14\u5bbd\u5ea6\u8d85\u51fa\u7236\u5bb9\u5668\u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173140175249761.jpg\" class=\"aligncenter\" title=\"HTML\u4e2d\u5982\u4f55\u5b9e\u73b0\u5b50\u5bb9\u5668\u9ad8\u5ea6\u7b49\u4e8e\u7236\u5bb9\u5668\u9ad8\u5ea6\uff0c\u4e14\u5bbd\u5ea6\u8d85\u51fa\u7236\u5bb9\u5668\u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff1f\u63d2\u56fe\" alt=\"HTML\u4e2d\u5982\u4f55\u5b9e\u73b0\u5b50\u5bb9\u5668\u9ad8\u5ea6\u7b49\u4e8e\u7236\u5bb9\u5668\u9ad8\u5ea6\uff0c\u4e14\u5bbd\u5ea6\u8d85\u51fa\u7236\u5bb9\u5668\u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff1f\u63d2\u56fe\" \/><\/p>\n<p>html\u4e2d\u5b9e\u73b0\u7279\u6b8a\u5e03\u5c40\u9700\u6c42<\/p>\n<p>\u5728\u4e2d\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u4e00\u4e9b\u5947\u8469\u7684\u9700\u6c42\u3002\u4f8b\u5982\uff0c\u73b0\u5728\u6709\u4eba\u8981\u6c42\u5b9e\u73b0\u5982\u4e0b\u6548\u679c\uff1a<\/p>\n<p><strong>\u9700\u6c42\uff1a<\/strong><\/p>\n<p> \u5bb9\u5668\u4e2d\uff0c \u7684\u9ad8\u5ea6\u7b49\u4e8e \u7684\u9ad8\u5ea6\uff0c \u7684\u5bbd\u5ea6\u8981\u8d85\u51fa \u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff08\uff09\u3002 <\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u4e0d\u6539\u53d8 html \u7ed3\u6784\u7684\u524d\u63d0\u4e0b\uff0c\u5982\u4f55\u5b9e\u73b0\uff1f <\/strong><\/p>\n<p><strong>\u89e3\u6cd5\uff1a<\/strong><\/p>\n<p>\u4e00\u79cd\u5b9e\u73b0\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;body&gt;\n  &lt;div class=\"box-1 container py-5\"&gt;\n    &lt;div class=\"box-2\"&gt;&lt;\/div&gt;\n    &lt;div class=\"box-3\"&gt;\n      111 &lt;br&gt;\n      111 &lt;br&gt;\n      111 &lt;br&gt;\n      111 &lt;br&gt;\n      111 &lt;br&gt;\n    &lt;\/div&gt;\n  &lt;\/div&gt;\n&lt;\/body&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>body {\n  margin: 0;\n}\n\n.container {\n  position: relative;\n}\n\n.box-2 {\n  width: 100vw;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0.2);\n  position: absolute;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u89e3\u91ca\uff1a<\/p>\n<ul>\n<li>\u5c06 \u8bbe\u7f6e\u4e3aposition: relative\uff0c\u8fd9\u6837 \u53ef\u4ee5 \u5728\u5176\u5185\u90e8\u3002 <\/li>\n<li>\u5c06 \u8bbe\u7f6e\u4e3a width: 100vw \u548c height: 100% \u4ee5\u4f7f\u5176\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\u3002 <\/li>\n<li>\u4f7f\u7528 position: absolute \u5c06 \u5b9a\u4f4d\u5728 \u7684\u5de6\u4e0a\u89d2\uff0c\u5e76\u4f7f\u7528 transform: translatex(-50%) \u5c06\u5176\u5c45\u4e2d\u3002 <\/li>\n<\/ul>\n<p><strong>\u8865\u5145\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u5df2\u5b9a\u4e49\u4e86.contner \u7684\u6700\u5927\u5bbd\u5ea6\uff0c\u5219\u9700\u8981\u5bf9  \u8fdb\u884c\u76f8\u5e94\u8c03\u6574\uff1a<\/p>\n<pre>.container {\n  max-width: 1000px;\n  padding: 0 5em;\n  margin: 0 auto;\n}\n\n... \u5176\u4ed6 CSS \u89c4\u5219\u4fdd\u6301\u4e0d\u53d8 ...<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fHTML\u4e2d\u5982\u4f55\u5b9e\u73b0\u5b50\u5bb9\u5668\u9ad8\u5ea6\u7b49\u4e8e\u7236\u5bb9\u5668\u9ad8\u5ea6\uff0c\u4e14\u5bbd\u5ea6\u8d85\u51fa\u7236\u5bb9\u5668\u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>html\u4e2d\u5b9e\u73b0\u7279\u6b8a\u5e03\u5c40\u9700\u6c42 \u5728\u4e2d\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u4e00\u4e9b\u5947\u8469\u7684\u9700\u6c42\u3002\u4f8b\u5982\uff0c\u73b0\u5728\u6709\u4eba\u8981\u6c42\u5b9e\u73b0\u5982\u4e0b\u6548\u679c\uff1a \u9700\u6c42\uff1a \u5bb9\u5668\u4e2d\uff0c \u7684\u9ad8\u5ea6\u7b49\u4e8e \u7684\u9ad8\u5ea6\uff0c \u7684\u5bbd\u5ea6\u8981\u8d85\u51fa \u5e76\u5360\u6ee1\u6574\u4e2a\u7a97\u53e3\uff08\uff09\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u4e0d\u6539\u53d8 html \u7ed3\u6784\u7684\u524d\u63d0\u4e0b\uff0c\u5982\u4f55\u5b9e\u73b0\uff1f \u89e3\u6cd5\uff1a \u4e00\u79cd\u5b9e\u73b0\u65b9\u6cd5\u5982\u4e0b\uff1a &lt;body&gt; &lt;div class=&#8221;box-1 container py-5&#8243;&gt; &lt;div class=&#8221;box-2&#8243;&gt;&lt;\/div&gt; &lt;div class=&#8221;box-3&#8243;&gt; 111 &lt;br&gt; 111 &lt;br&gt; 111 &lt;br&gt; 111 &lt;br&gt; 111 &lt;br&gt; &lt;\/div&gt; &lt;\/div&gt; &lt;\/body&gt; \u767b\u5f55\u540e\u590d\u5236 body { margin: 0; } .container { position: relative; } .box-2 { width: 100vw; height: 100%; background-color: rgba(0, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-28122","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28122","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=28122"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28122\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28122"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28122"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28122"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}