{"id":27874,"date":"2024-11-24T15:35:48","date_gmt":"2024-11-24T07:35:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/27874\/"},"modified":"2024-11-24T15:35:48","modified_gmt":"2024-11-24T07:35:48","slug":"%e5%a6%82%e4%bd%95%e8%ae%a9%e9%80%9a%e6%a0%8fbanner%e5%9b%be%e7%89%87%e7%ad%89%e6%af%94%e4%be%8b%e6%98%be%e7%a4%ba%ef%bc%8c%e4%b8%8d%e5%87%ba%e7%8e%b0%e8%a3%81%e5%89%aa%e6%88%96%e7%95%99%e7%99%bd","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/27874\/","title":{"rendered":"\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173132641699166.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u65e0\u53d8\u5f62\u3001\u5b8c\u6574\u663e\u793a\u4e0d\u88c1\u526a<\/strong><\/p>\n<p>\u5728\u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528\u56fe\u7247\u4f5c\u4e3abanner\u80cc\u666f\u3002\u4f46\u5982\u4f55\u8bbe\u7f6e\u56fe\u7247\u7684\u5c5e\u6027\uff0c\u624d\u80fd\u4f7f\u5176\u7b49\u6bd4\u4f8b\u5b8c\u6574\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\u5462\uff1f<\/p>\n<p>\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528 <\/strong><\/p>\n<p><strong> \u5bb9\u5668\u548c img \u6807\u7b7e <\/p>\n<pre>&lt;div class=\"image-container\"&gt;\n  @@##@@\n&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>image-contner \u6837\u5f0f\uff1a<\/p>\n<pre>.image-container {\n  width: 100%;\n  padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 \u7eb5\u6a2a\u6bd4 *\/\n  position: relative;\n  overflow: hidden;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>img \u6837\u5f0f\uff1a<\/p>\n<pre>.image-container img {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  object-fit: cover; \/* \u786e\u4fdd\u56fe\u7247\u8986\u76d6\u5bb9\u5668 *\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u4f7f\u7528\u80cc\u666f\u56fe<\/strong><\/p>\n<pre>&lt;div class=\"image-container\"&gt;&lt;\/div&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>image-container \u6837\u5f0f\uff1a<\/p>\n<pre>.image-container {\n  width: 100%;\n  padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 \u7eb5\u6a2a\u6bd4 *\/\n  background-image: url('your-image.jpg');\n  background-size: cover; \/* \u786e\u4fdd\u56fe\u7247\u8986\u76d6\u5bb9\u5668 *\/\n  background-position: center; \/* \u5c45\u4e2d\u5bf9\u9f50\u56fe\u7247 *\/\n  background-repeat: no-repeat; \/* \u9632\u6b62\u56fe\u7247\u91cd\u590d *\/\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u4e0a\u8ff0\u8bbe\u7f6e\uff0c\u65e0\u8bba\u4f7f\u7528 img \u6807\u7b7e\u8fd8\u662f\u80cc\u666f\u56fe\uff0c\u90fd\u53ef\u4ee5\u8ba9\u901a\u680fbanner\u56fe\u7247\u4ee5\u7b49\u6bd4\u4f8b\u5b8c\u6574\u663e\u793a\uff0c\u4e0d\u4f1a\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\u3002<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/www.php.cn\/faq\/your-image.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\uff1f\u63d2\u56fe1\" alt=\"\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\uff1f\u63d2\u56fe1\" \/> <\/strong> <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8ba9\u901a\u680fbanner\u56fe\u7247\u7b49\u6bd4\u4f8b\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\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\u8ba9\u901a\u680fbanner\u56fe\u7247\u65e0\u53d8\u5f62\u3001\u5b8c\u6574\u663e\u793a\u4e0d\u88c1\u526a \u5728\u7f51\u9875\u8bbe\u8ba1\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u9700\u8981\u4f7f\u7528\u56fe\u7247\u4f5c\u4e3abanner\u80cc\u666f\u3002\u4f46\u5982\u4f55\u8bbe\u7f6e\u56fe\u7247\u7684\u5c5e\u6027\uff0c\u624d\u80fd\u4f7f\u5176\u7b49\u6bd4\u4f8b\u5b8c\u6574\u663e\u793a\uff0c\u4e0d\u51fa\u73b0\u88c1\u526a\u6216\u7559\u767d\u5462\uff1f \u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u65b9\u6cd5\u5982\u4e0b\uff1a 1. \u4f7f\u7528 \u5bb9\u5668\u548c img \u6807\u7b7e &lt;div class=&#8221;image-container&#8221;&gt; @@##@@ &lt;\/div&gt; \u767b\u5f55\u540e\u590d\u5236 image-contner \u6837\u5f0f\uff1a .image-container { width: 100%; padding-top: calc(100% \/ (16 \/ 3)); \/* 16:3 \u7eb5\u6a2a\u6bd4 *\/ position: relative; overflow: hidden; } \u767b\u5f55\u540e\u590d\u5236 img \u6837\u5f0f\uff1a .image-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; \/* \u786e\u4fdd\u56fe\u7247\u8986\u76d6\u5bb9\u5668 *\/ [&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-27874","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27874","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=27874"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/27874\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=27874"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=27874"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=27874"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}