{"id":3365,"date":"2024-11-10T14:48:50","date_gmt":"2024-11-10T06:48:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3365\/"},"modified":"2024-11-10T14:48:50","modified_gmt":"2024-11-10T06:48:50","slug":"less%e4%b8%adcalc%e6%b7%b7%e5%90%88%e8%bf%90%e7%ae%97%e7%9a%84%e5%8d%95%e4%bd%8d%e8%a7%a3%e6%9e%90%e9%97%ae%e9%a2%98%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88-calc100-40px-4-%e4%bc%9a%e8%ae%a1","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3365\/","title":{"rendered":"Less\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48 `calc((100% &#8211; 40px) \/ 4)` \u4f1a\u8ba1\u7b97\u6210 `calc(15%)`\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173103408337038.jpg\" class=\"aligncenter\" title=\"Less\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48 `calc((100% &#8211; 40px) \/ 4)` \u4f1a\u8ba1\u7b97\u6210 `calc(15%)`\uff1f\u63d2\u56fe\" alt=\"Less\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48 `calc((100% &#8211; 40px) \/ 4)` \u4f1a\u8ba1\u7b97\u6210 `calc(15%)`\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>less\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898<\/strong><\/p>\n<p>\u5728Less\u4e2d\uff0c\u4f7f\u7528\u5e26\u6709\u5355\u4f4d\u7684\u6df7\u5408\u8fd0\u7b97\u7c7b\u578b\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u5355\u4f4d\u89e3\u6790\u95ee\u9898\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u4e0b\u8ff0Less\u4ee3\u7801\uff1a<\/p>\n<pre>calc((100% - 40px) \/ 4)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5e94\u8be5\u8ba1\u7b97\u4e3a calc(15%)\uff0c\u4f46\u662f\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5374\u8ba1\u7b97\u6210\u4e86 calc(15%)\u3002<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3aless\u5728\u89e3\u6790\u6b64\u8868\u8fbe\u5f0f\u65f6\u5ffd\u7565\u4e86\u5355\u4f4d\uff0c\u5c06\u6240\u6709\u5355\u4f4d\u6df7\u5408\u8fd0\u7b97\u90fd\u4f5c\u4e3a\u767e\u5206\u6bd4\u5904\u7406\u3002\u56e0\u6b64\uff0c\u8868\u8fbe\u5f0f\u88ab\u89e3\u6790\u4e3a calc(60%\/4)=calc(15%)\u3002<\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528 ~ \u64cd\u4f5c\u7b26\u5f3a\u5236\u4fdd\u7559\u5355\u4f4d\uff1a<\/li>\n<\/ol>\n<pre>calc((~\"100% - 40px\") \/ 4)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u5c06\u5e26\u5355\u4f4d\u7684\u503c\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d\uff0c\u7136\u540e\u5728\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\uff1a<\/li>\n<\/ol>\n<pre>@myHeight: 40px;\ncalc((~\"100% - @{myHeight}\") \/ 4)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fLess\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48 `calc((100% &#8211; 40px) \/ 4)` \u4f1a\u8ba1\u7b97\u6210 `calc(15%)`\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>less\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898 \u5728Less\u4e2d\uff0c\u4f7f\u7528\u5e26\u6709\u5355\u4f4d\u7684\u6df7\u5408\u8fd0\u7b97\u7c7b\u578b\u65f6\uff0c\u9700\u8981\u6ce8\u610f\u5355\u4f4d\u89e3\u6790\u95ee\u9898\u3002 \u4f8b\u5982\uff0c\u4e0b\u8ff0Less\u4ee3\u7801\uff1a calc((100% &#8211; 40px) \/ 4) \u767b\u5f55\u540e\u590d\u5236 \u5728\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5e94\u8be5\u8ba1\u7b97\u4e3a calc(15%)\uff0c\u4f46\u662f\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5374\u8ba1\u7b97\u6210\u4e86 calc(15%)\u3002 \u8fd9\u662f\u56e0\u4e3aless\u5728\u89e3\u6790\u6b64\u8868\u8fbe\u5f0f\u65f6\u5ffd\u7565\u4e86\u5355\u4f4d\uff0c\u5c06\u6240\u6709\u5355\u4f4d\u6df7\u5408\u8fd0\u7b97\u90fd\u4f5c\u4e3a\u767e\u5206\u6bd4\u5904\u7406\u3002\u56e0\u6b64\uff0c\u8868\u8fbe\u5f0f\u88ab\u89e3\u6790\u4e3a calc(60%\/4)=calc(15%)\u3002 \u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a \u4f7f\u7528 ~ \u64cd\u4f5c\u7b26\u5f3a\u5236\u4fdd\u7559\u5355\u4f4d\uff1a calc((~&#8221;100% &#8211; 40px&#8221;) \/ 4) \u767b\u5f55\u540e\u590d\u5236 \u5c06\u5e26\u5355\u4f4d\u7684\u503c\u5b58\u50a8\u5728\u53d8\u91cf\u4e2d\uff0c\u7136\u540e\u5728\u8868\u8fbe\u5f0f\u4e2d\u4f7f\u7528\uff1a @myHeight: 40px; calc((~&#8221;100% &#8211; @{myHeight}&#8221;) \/ 4) \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fLess\u4e2dcalc\u6df7\u5408\u8fd0\u7b97\u7684\u5355\u4f4d\u89e3\u6790\u95ee\u9898\uff1a\u4e3a\u4ec0\u4e48 `calc((100% &#8211; 40px) \/ 4)` \u4f1a\u8ba1\u7b97\u6210 `calc(15%)`\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3365","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3365","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=3365"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3365\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}