{"id":11424,"date":"2024-11-14T21:54:23","date_gmt":"2024-11-14T13:54:23","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11424"},"modified":"2026-02-27T11:26:49","modified_gmt":"2026-02-27T03:26:49","slug":"css-calc-interpolate-size","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2024\/11\/css-calc-interpolate-size\/","title":{"rendered":"\u8fd9\u5565?CSS calc-size\u548cinterpolate-size,\u771f\u5b66\u4e0d\u52a8\u4e86"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11424\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11424<\/a><br \/>\n\u672c\u6587\u53ef\u5168\u6587\u8f6c\u8f7d\uff0c\u72ec\u7acb\u57df\u540d\u4e2a\u4eba\u7f51\u7ad9\u65e0\u9700\u6388\u6743\uff0c\u4f46\u9700\u8981\u4fdd\u7559\u539f\u4f5c\u8005\u3001\u51fa\u5904\u4ee5\u53ca\u6587\u4e2d\u94fe\u63a5\uff0c\u4efb\u4f55\u7f51\u7ad9\u5747\u53ef\u6458\u8981\u805a\u5408\uff0c\u5546\u7528\u8bf7\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202411-calc-size.jpg';<\/script><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/fruit-cover.jpg\" width=\"415\" height=\"261\" alt=\"\u6c34\u679c\u52a8\u753b\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright clip thumb size-medium\" \/><\/p>\n<p>\u5c31\u7b97\u6bcf\u5468\u5b66\u4e60\u4e00\u4e2a\u524d\u7aef\u65b0\u7279\u6027\uff0c\u6211\u53d1\u73b0\u6211\u90fd\u6765\u4e0d\u53ca\u5b66\u4e60\u3002<\/p>\n<p>\u90fd\u6ca1\u6709\u65f6\u95f4\u9493\u9c7c\u4e86\uff0c\u82e6\u554a\u3002<\/p>\n<p>\u8fd9\u4e0d\uff0c\u53c8\u51fa\u4e86\u4e2a\u5565<code>calc-size()<\/code>\u51fd\u6570\u548c<code>interpolate-size<\/code>\u5c5e\u6027\u3002<\/p>\n<p>\u6ca1\u5173\u7cfb\uff0c\u6211\u8fd8\u5b66\u5f97\u52a8\uff0c\u5feb\u6276\u6211\u8d77\u6765\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/2024-11-12_003608.jpeg\" width=\"144\" height=\"144\" alt=\"\u6276\u6211\u8d77\u6765\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e00\u3001\u975e\u56fa\u5b9a\u5c3a\u5bf8\u4e5f\u80fd\u52a8\u753b<\/h3>\n<p><code>calc-size()<\/code>\u51fd\u6570\u548c<code>interpolate-size<\/code>\u5c5e\u6027\u7684\u8bbe\u8ba1\u521d\u8877\u662f\u4e00\u81f4\u7684\uff0c\u5c31\u662f\u53ef\u4ee5\u8ba9width\u3001height\u7b49\u5c3a\u5bf8\u76f8\u5173\u7684\u5c5e\u6027\u5373\u4f7f\u503c\u662fauto\uff0c\u4e5f\u80fd\u6709transition\u8fc7\u6e21\u52a8\u753b\u6548\u679c\u3002<\/p>\n<p>\u6700\u5177\u4ee3\u8868\u6027\u7684\u5c31\u662fheight:auto\u7684\u8fc7\u6e21\u52a8\u753b\u5b9e\u73b0\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>&lt;button onClick=\"this.classList.toggle('active');\"&gt;\u70b9\u51fb\u6211&lt;\/button&gt;\r\n&lt;p&gt;\r\n    &lt;img src=\"html-book.jpeg\" width=\"256\" \/&gt;\r\n&lt;\/p&gt;<\/pre>\n<pre>p {\r\n    height: 0;\r\n    transition: height .25s;\r\n    overflow: hidden;\r\n}\r\n.active + p {\r\n    height: auto;\r\n    height: calc-size(auto, size);\r\n}<\/pre>\n<p>\u6b64\u65f6\uff0c\u5728Chrome 129\u53ca\u5176\u4ee5\u4e0a\u7248\u672c\u6d4f\u89c8\u5668\u4e0b\uff0c\u70b9\u51fb\u6309\u94ae\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u56fe\u7247\u4ee5\u5207\u7247\u52a8\u753b\u7684\u5f62\u5f0f\u5448\u73b0\u4e86\uff0c\u5982\u4e0bGIF\u52a8\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/image-toggle.gif\" width=\"251\" height=\"313\" alt=\"height:auto\u52a8\u753b\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202411\/css-calc-size-height-auto-transition-demo.php\">CSS calc-size()\u5b9e\u73b0height:auto\u52a8\u753bdemo<\/a><\/p>\n<p><strong>\u8865\u5145\u4e8e2026\u5e742\u670827\u65e5<\/strong><\/p>\n<p><code>calc-size()<\/code>\u8fd8\u6709\u4e2a\u884d\u751f\u4f5c\u7528\uff0c\u53ef\u4ee5\u8ba9<code>clamp()<\/code>\u51fd\u6570\u652f\u6301<code>auto<\/code>\u7b49\u5173\u952e\u5b57\u3002<\/p>\n<p>\u662f\u8fd9\u6837\u7684\u3002<\/p>\n<p>\u5982\u679c\u6211\u4eec\u76f4\u63a5\u5728<code>clamp()<\/code>\u51fd\u6570\u4e2d\u4f7f\u7528<code>auto<\/code>\u662f\u4e0d\u5408\u6cd5\u7684\u3002<\/p>\n<pre>.box {\r\n  \/* \u4ee5\u4e0b\u4ee3\u7801\u65e0\u6548 *\/\r\n  width: clamp(200px, auto, 400px);\r\n}<\/pre>\n<p>\u4f46\u662f\u4f7f\u7528<code>calc-size()<\/code>\u51fd\u6570\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u674e\u4ee3\u6843\u50f5\u3002<\/p>\n<pre>.box {\r\n  \/* \u4ee5\u4e0b\u4ee3\u7801\u6709\u6548 *\/\r\n  width: calc-size(auto,clamp(200px, size, 400px));\r\n  \/* \u7b49\u540c\u4e8e clamp(200px, auto, 400px) *\/\r\n}<\/pre>\n<p>\u5176\u4ed6\u4e00\u4e9b\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>.box {\r\n  width: calc-size(max-content, clamp(size, 70%, 600px)); \r\n  \/* \u7b49\u540c\u4e8e clamp(max-content, 70%, 600px) *\/\r\n  width: calc-size(max-content, clamp(300px, 80%, 2 * size)); \r\n  \/* \u7b49\u540c\u4e8e clamp(300px, 80%, 2 * max-content) *\/\r\n  width: calc-size(min-content, clamp(size + 50px, 100% - 40px, 700px));\r\n  \/* \u7b49\u540c\u4e8e clamp(min-content + 50px, 100% - 40px, 700px) *\/\r\n  width: calc-size(max-content, clamp(size, 80%, 2 * size))\r\n  \/* \u7b49\u540c\u4e8e clamp(max-content, 80%, 2 * max-content) *\/\r\n}<\/pre>\n<h3>\u4e8c\u3001interpolate-size\u7528\u6cd5\u66f4\u7b80\u5355<\/h3>\n<p>\u5176\u5b9e\uff0c\u8981\u8ba9<code>height:auto<\/code>\u652f\u6301transition\u8fc7\u6e21\u52a8\u753b\uff0c\u8fd8\u6709\u4e2a\u66f4\u7b80\u5355\u7684\u65b9\u6cd5\uff0c\u5c31\u662f\u5728\u7956\u5148\u5bb9\u5668\u4e0a\u8bbe\u7f6e\uff1a<\/p>\n<pre>interpolate-size: allow-keywords;<\/pre>\n<p>interpolate\u662f\u63d2\u5165\uff0c\u7be1\u6539\u7684\u610f\u601d\uff0c\u8fde\u8d77\u6765\u8868\u793a\u5c3a\u5bf8\u63d2\u503c\u53d8\u5316\u5141\u8bb8\u5173\u952e\u5b57\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u72e0\u4e00\u70b9\uff0c\u76f4\u63a5\u5728\u6839\u5143\u7d20\u4e0a\u662f\u8bbe\u7f6e\uff1a<\/p>\n<pre>:root {\r\n  interpolate-size: allow-keywords;\r\n}<\/pre>\n<p>\u90a3\u4e48\uff0c\u9875\u9762\u4e0a\uff0c\u6240\u6709\u7684\u5143\u7d20\u90fd\u80fd\u89e6\u53d1<code>height:auto<\/code>\u7684\u8fc7\u6e21\u52a8\u753b\u6548\u679c\uff0c\u65e0\u9700\u4e13\u95e8\u7684<code>calc-size()<\/code>\u8bbe\u7f6e\u3002<\/p>\n<p>\u6362\u53e5\u8bdd\u8bf4\uff0c<code>calc-size()<\/code>\u51fd\u6570\u662f\u4e13\u95e8\u5355\u72ec\u8bbe\u7f6e\uff0c\u800c<code>interpolate-size<\/code>\u662f\u5168\u5c40\u6279\u91cf\u8bbe\u7f6e\u3002<\/p>\n<p>\u5143\u7d20\u8bbe\u7f6e\u4e86<code>calc-size()<\/code>\u503c\uff0c\u6d4f\u89c8\u5668\u4f1a\u81ea\u52a8\u8bbe\u7f6e\u5176<code>interpolate-size<\/code>\u5c5e\u6027\u7684\u8ba1\u7b97\u503c\u662f<code>allow-keywords<\/code>\u3002<\/p>\n<h4>interpolate-size\u8bed\u6cd5<\/h4>\n<p>\u8bed\u6cd5\u793a\u610f\uff1a<\/p>\n<pre>interpolate-size: allow-keywords;\r\ninterpolate-size: numeric-only;<\/pre>\n<p>\u5176\u4e2d\uff0c\u503c<code>numeric-only<\/code>\u5c31\u662f\u9ed8\u8ba4\u7684\u5dee\u503c\u8ba1\u7b97\u89c4\u5219\uff0c\u8868\u793a\u4ec5\u6570\u503c\u7c7b\u578b\u7684\u5c5e\u6027\u503c\u624d\u8fd0\u884c\u5dee\u503c\u8ba1\u7b97\u3002<\/p>\n<p>\u6765\u770b\u4e00\u4e2a\u4f7f\u7528\u6848\u4f8b\uff0c\u8fd9\u6b21\u6211\u4eec\u4f7f\u7528\u5bbd\u5ea6\u793a\u610f\uff0c\u76f8\u5173\u7684HTML\u548cCSS\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>&lt;button onClick=\"this.classList.toggle('active');\"&gt;\u70b9\u51fb\u6211&lt;\/button&gt;\r\n&lt;figure&gt;\r\n    &lt;img src=\"html-book.jpeg\" width=\"256\" \/&gt;\r\n&lt;\/figure&gt;<\/pre>\n<pre>figure {\r\n    width: 320px;\r\n    padding: 1em;\r\n    transition: width .25s;\r\n    interpolate-size: allow-keywords;\r\n    background: deepskyblue;\r\n}\r\n.active + figure {\r\n    width: fit-content;\r\n}<\/pre>\n<p>\u6548\u679c\u53c2\u89c1\u5982\u4e0bGIF\u5f55\u5c4f\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/image-width-toggle.gif\" width=\"354\" height=\"263\" alt=\"\u5bbd\u5ea6fit-content\u8fc7\u6e21\u52a8\u753b\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202411\/css-interpolate-size-fit-content-transition-demo.php\" rel=\"noopener\" target=\"_blank\">CSS interpolate-size\u5b9e\u73b0width:fit-content\u52a8\u753bdemo<\/a><\/p>\n<h3>\u4e09\u3001calc-size\u7684\u8bed\u6cd5<\/h3>\n<p><code>calc-size()<\/code>\u51fd\u6570\u652f\u6301\u7684\u80fd\u529b\u8fd8\u633a\u4e30\u5bcc\u7684\uff0c\u4f7f\u7528\u53c2\u8003\uff1a<\/p>\n<pre>\/* \u5355\u503c\u8bbe\u7f6e *\/\r\ncalc-size(auto, size)\r\ncalc-size(fit-content, size)\r\n\r\n\/* \u6267\u884c\u8ba1\u7b97 *\/\r\ncalc-size(min-content, size + 100px)\r\ncalc-size(max-content, size - 80em)\r\ncalc-size(fit-content, size \/ 2)\r\n\r\n\/* \u51fd\u6570\u8ba1\u7b97 *\/\r\ncalc-size(auto, round(up, size, 50px))<\/pre>\n<p>\u5173\u952e\u5b57<code>size<\/code>\u8868\u793a\u51fd\u6570\u7b2c\u4e00\u4e2a\u5173\u952e\u5b57\u503c\u5bf9\u5e94\u7684\u8ba1\u7b97\u5c3a\u5bf8\uff0c\u5982\u679c\u662f\u56fe\u7247\uff0c\u5219\u8868\u793a\u56fe\u7247\u7684\u539f\u59cb\u5c3a\u5bf8\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5e0c\u671b\u70b9\u51fb\u56fe\u7247\u7f29\u7565\u56fe\uff0c\u56fe\u7247\u4ee5\u52a8\u753b\u5f62\u5f0f\u653e\u5927\u5230\u539f\u59cb\u5c3a\u5bf8\u76841\/2\uff0c\u90a3\u4e48\u5c31\u4e0d\u9700\u8981JavaScript\u4ee3\u7801\u53c2\u4e0e\u4e86\uff0c\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>&lt;img \r\n  src=\"1.jpg\" \r\n  onClick=\"this.classList.toggle('active');\" \r\n\/&gt;<\/pre>\n<pre>img {\r\n    transition: .3s;\r\n    width: 128px;\r\n}\r\nimg.active {\r\n    width: calc-size(fit-content, size \/ 2);\r\n}<\/pre>\n<p>MP4\u5f55\u5c4f\u6548\u679c\u53c2\u89c1\uff08\u4e0d\u52a8\u70b9\u51fb\u64ad\u653e\uff09\uff1a<\/p>\n<p><video src='\/\/image.zhangxinxu.com\/video\/blog\/202411\/img-resize-toggle.mp4' type=\"video\/mp4\" width=\"267\" height=\"207\" preload=\"auto\" muted autoplay autobuffer loop x-webkit-airplay=\"allow\" x5-video-player-type=\"h5\" x5-video-player-fullscreen=\"true\" x5-video-orientation=\"portraint\" webkit-playsinline=\"true\" playsinline=\"true\" \u200b\u200b\u200b\u200bposter=\"\/\/image.zhangxinxu.com\/image\/blog\/201806\/poster.png\"><\/video><\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202411\/css-calc-size-image-resize-transition-demo.php\" rel=\"noopener\" target=\"_blank\">CSS calc-size()\u5b9e\u73b0\u56fe\u7247\u539f\u59cb\u5c3a\u5bf8\u653e\u5927demo<\/a><\/p>\n<p>&#8212;<\/p>\n<p>\u53e6\u5916\uff0c\u8fd9\u91cc\u51fa\u73b0\u7684round()\u51fd\u6570\u8fd8\u662f\u633a\u5b9e\u7528\u7684\uff0c\u53c2\u89c1\u4e0d\u4e45\u524d\u6211\u64b0\u5199\u7684\u8fd9\u7bc7\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2024\/09\/css-math-round-function\/\">\u65f6\u9694\u4e24\u5e74\uff0cChrome\u4e5f\u652f\u6301round\u7b49CSS\u6570\u5b66\u51fd\u6570\u4e86<\/a>\u201d<\/p>\n<h3>\u56db\u3001\u5e76\u975e\u9002\u7528\u6240\u6709CSS\u5c5e\u6027<\/h3>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u65e0\u8bba\u662f<code>calc-size()<\/code>\u51fd\u6570\u8fd8\u662f<code>interpolate-size<\/code>\u5c5e\u6027\uff0c\u90fd\u53ea\u9002\u7528\u4e8e\u4e0e\u5c3a\u5bf8\u76f8\u5173\u7684\u4e9bCSS\u5c5e\u6027\u3002<\/p>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u4e00\u4e2ablock\u6c34\u5e73\u5143\u7d20\uff0c\u9ed8\u8ba4<code>margin:0<\/code>\uff0c\u7136\u540e\u8bbe\u7f6e<code>margin:auto<\/code>\u8ba9\u5176\u5c45\u4e2d\uff0c\u5e0c\u671b\u6709\u52a8\u753b\uff0c\u90a3\u4e48\u4e0b\u9762\u7684\u7528\u6cd5\u662f\u65e0\u6548\u7684\uff1a<\/p>\n<pre>.element {\r\n    margin: calc-size(auto, size);\r\n}<\/pre>\n<p>\u63a7\u5236\u53f0\u663e\u793a\u4e0d\u5408\u6cd5\uff0c\u5982\u4e0b\u622a\u56fe\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/2024-11-13_221116.png\" width=\"274\" height=\"142\" alt=\"margin\u4f7f\u7528calc-size\u5c5e\u6027\u65e0\u6548\" class=\"alignnone size-medium\" \/><\/p>\n<h3>\u4e94\u3001\u6e29\u6545\u77e5\u65b0display:none\u52a8\u753b<\/h3>\n<p>\u4e4b\u524d<code>transition<\/code>\u52a8\u753b\u7684\u4e24\u4e2a\u75db\u70b9\uff0c\u4e00\u4e2a\u662f<code>height:auto<\/code>\uff0c\u53e6\u5916\u4e00\u4e2a\u5c31\u662f<code>display:none<\/code>\u3002<\/p>\n<p><code>display:none<\/code>\u5176\u5b9e\u4e5f\u6709\u4e13\u95e8\u7684\u65b0\u7279\u6027\u89e3\u51b3\u6b64\u75db\u70b9\uff0c\u662fCSS <code>transition-behavior<\/code>\u5c5e\u6027\u548c<code>@starting-style<\/code>\u89c4\u5219\u3002<\/p>\n<p>\u611f\u5174\u8da3\u7684\u53ef\u4ee5\u8bbf\u95ee\u8fd9\u7bc7\u6587\u7ae0\uff1a\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2024\/06\/css-transition-behavior\/\">CSS transition-behavior\u8ba9display none\u4e5f\u6709\u52a8\u753b\u6548\u679c<\/a>\u201d<\/p>\n<h4>\u4e4b\u524dheight:auto\u52a8\u753b\u5b9e\u73b0<\/h4>\n<p>\u4e00\u79cd\u662f\u4f7f\u7528\u8db3\u591f\u5927\u7684<code>max-height<\/code>\u503c\uff0c\u8fd9\u4e2a\u662f\u6700\u8001\u7684\u65b9\u6cd5\u4e86\u3002<\/p>\n<p>\u540e\u6765\u662f\u4f7f\u7528Grid\u5e03\u5c40\u4e2d\u7684fr\u5355\u4f4d\u7279\u6027\u5b9e\u73b0\uff0c\u539f\u7406\u5c31\u662f0fr\u21921fr\uff0c\u6848\u4f8b\u793a\u610f\uff1a<\/p>\n<pre>&lt;button onClick=\"this.classList.toggle('active');\"&gt;\u70b9\u51fb\u6211&lt;\/button&gt;\r\n&lt;figure&gt;\r\n    &lt;img src=\"html-book.jpeg\" width=\"256\" \/&gt;\r\n&lt;\/figure&gt;<\/pre>\n<pre>figure {\r\n    display: grid;\r\n    grid-template-rows: 0fr;\r\n    transition: .25s;\r\n    overflow: hidden;\r\n}\r\nfigure img {\r\n    min-height: 0;\r\n}\r\n.active + figure {\r\n    grid-template-rows: 1fr;\r\n}<\/pre>\n<p>GIF\u6548\u679c\u622a\u56fe\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/image-toggle.gif\" width=\"251\" height=\"313\" alt=\"height:auto\u52a8\u753b\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202411\/css-grid-fr-height-auto-transition-demo.php\" rel=\"noopener\" target=\"_blank\">CSS Grid fr\u5355\u4f4d\u5b9e\u73b0height:auto\u52a8\u753bdemo<\/a><\/p>\n<h3>\u516d\u3001\u517c\u5bb9\u6027\u53ca\u788e\u788e\u5ff5<\/h3>\n<p><code>calc-size()<\/code>\u51fd\u6570\u548c<code>interpolate-size<\/code>\u5c5e\u6027\u90fd\u662f\u4eceChrome 129\u7248\u672c\u5f00\u59cb\u652f\u6301\u7684\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/2024-11-14_212642.png\" width=\"628\" height=\"215\" alt=\"calc-size\u517c\u5bb9\u6027\u622a\u56fe\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u4e0d\u8fc7\u5e76\u4e0d\u5f71\u54cd\u6211\u4eec\u7684\u4f7f\u7528\uff0c\u6bd5\u7adf\u662f\u6e10\u8fdb\u589e\u5f3a\u7279\u6027\u3002<\/p>\n<p>\u4e00\u770b\u65f6\u95f4\uff0c\u8fd8\u65e9\uff0c\u518d\u626f\u70b9\u5176\u4ed6\u4e1c\u897f\u5427\u3002<\/p>\n<p>\u6587\u5b57\u7248\u535a\u5ba2\u73b0\u5728\u770b\u5f97\u4eba\u8d8a\u6765\u8d8a\u5c11\u4e86\uff0cHTML\u65b0\u4e66\u51fa\u7248\u4e4b\u540e\uff0c\u7b97\u662f\u6709\u4e86\u70b9\u5148\u529f\u592b\uff0c\u5c31\u5f04\u4e86\u4e2a\u6296\u97f3\u8d26\u53f7\uff0c\u540d\u53eb\u201c\u5f20\u946b\u65ed\u672c\u4eba\u201d\uff0c\u5509\uff0c\u8001\u4eba\u5bb6\uff0c\u540e\u77e5\u540e\u89c9\uff0c\u6ca1\u6709\u63d0\u524d\u628a\u540d\u79f0\u5360\u597d\u4f4d\u7f6e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/2024-11-14_213023.jpg\" width=\"418\" height=\"198\" alt=\"\u5f20\u946b\u65ed\u672c\u4eba\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u76ee\u524d\u6bcf\u5468\u66f4\u65b02~3\u4e2a\u89c6\u9891\u7684\u8282\u594f\uff0c\u5168\u662f\u4e0e\u524d\u7aef\u5f00\u53d1\u76f8\u5173\u7684\uff0c\u5076\u7136\u4e5f\u4f1a\u8bb2\u4e0b\u4eba\u6587\uff0c\u516b\u5366\u76f8\u5173\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u6b22\u8fce\u5173\u6ce8\u54c8\uff01<\/p>\n<p>\u53e6\u5916\uff0c\u7528\u4e866\u5e74\u7684\u4e91\u6570\u636e\u5e93\u5230\u671f\u4e86\uff0c\u4e0d\u7eed\u4e86\uff0c6\u5e74\u524d\u524d\u7aef\u5927\u70ed\uff0c\u7f51\u7ad9\u6d41\u91cf\u5dc5\u5cf0\uff0c\u4e0d\u582a\u91cd\u8d1f\uff0c\u4e8e\u662f\u5c06\u6570\u636e\u5e93\u72ec\u7acb\u51fa\u53bb\u4e86\uff0c1\u5e74\u5343\u628a\u5757\u94b1\u3002<\/p>\n<p>\u73b0\u5728\u7684\u8bbf\u95ee\u91cf\u4e5f\u5c31\u5dc5\u5cf0\u65f6\u5019\u76841\/10\uff0c\u6211\u4e00\u770b\u6570\u636e\u5e93\u7684\u8d44\u6e90\u5360\u7528\uff0c\u5976\u5976\u4e2a\u718a\uff0cCPU\u53ea\u7528\u4e861%~2%\uff0c\u4e25\u91cd\u6d6a\u8d39\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8d81\u8fd9\u6b21\u5230\u671f\uff0c\u53c8\u548c\u4e4b\u524d\u4e00\u6837\uff0c\u76f4\u63a5\u5728\u4e91\u670d\u52a1\u5668\u4e0a\u4f7f\u7528\u672c\u5730\u6570\u636e\u5e93\uff0c\u597d\u5bb6\u4f19\uff0c\u8fd9\u9875\u9762\u52a0\u8f7d\u901f\u5ea6\uff0c\u660e\u663e\u5feb\u591a\u4e86\uff0c\u79d2\u5f00\uff0c\u4e91\u670d\u52a1\u5668\u538b\u529b\u4e5f\u4e0d\u5927\uff0c\u7701\u94b1\u4e86\uff0c\u5f00\u5fc3\u3002<\/p>\n<p>\u597d\uff0c\u5c31\u8fd9\u4e48\u591a\u5427\uff0c\u611f\u8c22\u9605\u8bfb\uff0c\u6b22\u8fce<button onclick=\"shareWeixin.click()\" class=\"entry-share-btn\">\u5206\u4eab<\/button>\uff0c\u5723\u5973\u4e3a\u4f60\u70b9\u8d5e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/2024-11-14_214321.jpg\" width=\"120\" height=\"151\" alt=\"\u5723\u5973\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u4f1a\u7ecf\u5e38\u66f4\u65b0\u77e5\u8bc6\u70b9\u4ee5\u53ca\u4fee\u6b63\u4e00\u4e9b\u9519\u8bef\uff0c\u56e0\u6b64\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u539f\u51fa\u5904\uff0c\u65b9\u4fbf\u6eaf\u6e90\uff0c\u907f\u514d\u9648\u65e7\u9519\u8bef\u77e5\u8bc6\u7684\u8bef\u5bfc\uff0c\u540c\u65f6\u6709\u66f4\u597d\u7684\u9605\u8bfb\u4f53\u9a8c\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11424\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11424<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202411\/fruit-cover.jpg\" width=\"160\" height=\"101\" alt=\"\u6c34\u679c\u52a8\u753b\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u597d\u6d88\u606f\uff0cheight:auto\u3001width:fit-content\u8fd9\u4e9b\u4ee5\u524d\u65e0\u6cd5\u89e6\u53d1transition\u8fc7\u6e21\u6548\u679c\u7684CSS\u58f0\u660e\uff0c\u73b0\u5728\u4e5f\u80fd\u52a8\u753b\u5566\uff0c\u5c31\u662f\u4f7f\u7528calc-size()\u51fd\u6570\u6216interpolate-size\u5c5e\u6027\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[971,2013,1523,1059,2014,1057,1058,288,204],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11424"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=11424"}],"version-history":[{"count":12,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11424\/revisions"}],"predecessor-version":[{"id":12101,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11424\/revisions\/12101"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=11424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=11424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=11424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}