{"id":27704,"date":"2024-11-24T12:12:09","date_gmt":"2024-11-24T04:12:09","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27704\/"},"modified":"2024-11-24T12:12:09","modified_gmt":"2024-11-24T04:12:09","slug":"%e5%a6%82%e4%bd%95%e4%bc%98%e9%9b%85%e5%9c%b0%e6%98%be%e7%a4%ba%e9%80%9a%e6%a0%8f%e6%af%94%e4%be%8b%e5%9b%be%e7%89%87%ef%bc%8c%e4%bf%9d%e8%af%81%e6%97%a0%e8%a3%81%e5%89%aa%e6%97%a0%e7%95%99%e7%99%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27704\/","title":{"rendered":"\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173130696569500.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f<\/strong><\/p>\n<p>\u5f53\u6211\u4eec\u60f3\u8981\u5728\u7f51\u9875\u4e2d\u5c55\u793a\u4e00\u5f20\u6bd4\u4f8b\u56fa\u5b9a\u7684\u901a\u680f\u56fe\u7247\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u56fe\u7247\u53d8\u5f62\u6216\u5185\u5bb9\u88ab\u88c1\u526a\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u96be\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u56fe\u7247\u7684\u6bd4\u4f8b\u7075\u6d3b\u8fd0\u7528  \u6837\u5f0f\uff0c\u5b9e\u73b0\u56fe\u7247\u7684\u65e0\u88c1\u526a\u65e0\u7559\u767d\u663e\u793a\u3002<\/p>\n<p><strong>\u65b9\u6848 1\uff1a\u9488\u5bf9 img \u6807\u7b7e<\/strong><\/p>\n<p>\u5982\u679c\u4f7f\u7528\u7684\u662f img \u6807\u7b7e\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;div class=\"image-container\"&gt;\n  @@##@@\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>.image-container {\n  width: 100%;\n  padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 aspect ratio *\/\n  position: relative;\n  overflow: hidden;\n}\n\n.image-container img {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  object-fit: cover; \/* ensures the image covers the container *\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6848 2\uff1a\u9488\u5bf9\u80cc\u666f\u56fe<\/strong><\/p>\n<p>\u5982\u679c\u56fe\u7247\u4f5c\u4e3a\u80cc\u666f\u56fe\u52a0\u8f7d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<pre>&lt;div class=\"image-container\"&gt;&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<pre>.image-container {\n  width: 100%;\n  padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 aspect ratio *\/\n  background-image: url('your-image.jpg');\n  background-size: cover; \/* Ensures the image covers the container *\/\n  background-position: center; \/* Centers the image *\/\n  background-repeat: no-repeat; \/* Prevents the image from repeating *\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u7075\u6d3b\u7684 css \u6837\u5f0f\u914d\u7f6e\uff0c\u53ef\u4ee5\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u56fe\u7247\uff0c\u786e\u4fdd\u56fe\u7247\u4fdd\u6301\u539f\u59cb\u6bd4\u4f8b\uff0c\u65e0\u88c1\u526a\u4e14\u65e0\u7559\u767d\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.php.cn\/faq\/your-image.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f\u63d2\u56fe1\" alt=\"\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f\u63d2\u56fe1\" \/> <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\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>\u5982\u4f55\u4f18\u96c5\u5730\u663e\u793a\u901a\u680f\u6bd4\u4f8b\u56fe\u7247\uff0c\u4fdd\u8bc1\u65e0\u88c1\u526a\u65e0\u7559\u767d\uff1f \u5f53\u6211\u4eec\u60f3\u8981\u5728\u7f51\u9875\u4e2d\u5c55\u793a\u4e00\u5f20\u6bd4\u4f8b\u56fa\u5b9a\u7684\u901a\u680f\u56fe\u7247\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u56fe\u7247\u53d8\u5f62\u6216\u5185\u5bb9\u88ab\u88c1\u526a\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u96be\u9898\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u56fe\u7247\u7684\u6bd4\u4f8b\u7075\u6d3b\u8fd0\u7528 \u6837\u5f0f\uff0c\u5b9e\u73b0\u56fe\u7247\u7684\u65e0\u88c1\u526a\u65e0\u7559\u767d\u663e\u793a\u3002 \u65b9\u6848 1\uff1a\u9488\u5bf9 img \u6807\u7b7e \u5982\u679c\u4f7f\u7528\u7684\u662f img \u6807\u7b7e\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u4ee3\u7801\uff1a &lt;div class=&#8221;image-container&#8221;&gt; @@##@@ &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 .image-container { width: 100%; padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 aspect ratio *\/ position: relative; overflow: hidden; } .image-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; \/* ensures the image covers [&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-27704","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27704","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=27704"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27704\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}