{"id":25978,"date":"2024-11-24T10:59:58","date_gmt":"2024-11-24T02:59:58","guid":{"rendered":"https:\/\/fwq.ai\/blog\/25978\/"},"modified":"2024-11-24T10:59:58","modified_gmt":"2024-11-24T02:59:58","slug":"%e7%a7%bb%e5%8a%a8%e7%ab%af%e9%a1%b9%e7%9b%ae%e4%b8%ad%ef%bc%8c%e5%a6%82%e4%bd%95%e6%b6%88%e9%99%a4rem%e5%ad%97%e4%bd%93%e5%a4%a7%e5%b0%8f%e8%ae%a1%e7%ae%97%e5%b8%a6%e6%9d%a5%e7%9a%84css%e6%89%ad-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/25978\/","title":{"rendered":"\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u5982\u4f55\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684CSS\u626d\u66f2\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173076913217866.jpg\" class=\"aligncenter\" title=\"\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u5982\u4f55\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684CSS\u626d\u66f2\uff1f\u63d2\u56fe\" alt=\"\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u5982\u4f55\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684CSS\u626d\u66f2\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684\u626d\u66f2<\/strong><\/p>\n<p>\u5728\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528rem\u8ba1\u7b97\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u53ef\u4ee5\u5b9e\u73b0\u81ea\u9002\u5e94\u5e03\u5c40\u3002\u4f46\u662f\uff0c\u6b64\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5bfc\u81f4\u9875\u9762\u6253\u5f00\u65f6\u51fa\u73b0css\u626d\u66f2\uff0c\u8fd9\u662f\u56e0\u4e3a\u9875\u9762\u5185\u5bb9\u5728\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8d4b\u503c\u540e\u91cd\u65b0\u6e32\u67d3\u9020\u6210\u7684\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u8981\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u5c06\u8ba1\u7b97\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u7684js\u811a\u672c\u79fb\u52a8\u5230\u9875\u9762\u7684\u6700\u524d\u9762\uff0c\u5373head\u6807\u7b7e\u5185\u3002<\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p><strong>\u539f\u56e0\uff1a<\/strong><\/p>\n<p>\u5f53\u6d4f\u89c8\u5668\u52a0\u8f7d\u9875\u9762\u65f6\uff0c\u5b83\u4f1a\u6309\u7167\u987a\u5e8f\u6267\u884c\u9875\u9762\u4e2d\u7684\u4ee3\u7801\u3002\u5982\u679c\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u7684js\u811a\u672c\u4f4d\u4e8e\u9875\u9762\u5e95\u90e8\uff0c\u5f53\u6d4f\u89c8\u5668\u8fd0\u884c\u5230\u8be5\u4ee3\u7801\u65f6\uff0c\u9875\u9762\u5185\u5bb9\u5df2\u7ecf\u52a0\u8f7d\u5e76\u663e\u793a\u4e86\u3002\u968f\u540e\uff0c\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8d4b\u503c\u4f1a\u89e6\u53d1\u9875\u9762\u91cd\u65b0\u6e32\u67d3\uff0c\u4ece\u800c\u5bfc\u81f4css\u626d\u66f2\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>&lt;head&gt;\n  &lt;!-- \u79fb\u52a8\u7aef\u81ea\u9002\u5e94\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97 --&gt;\n  &lt;script&gt;\n    (function () {\n      const rootFontSize = 16;\n      document.documentElement.style.fontSize = rootFontSize + \"px\";\n    })();\n  &lt;\/script&gt;\n&lt;\/head&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06\u8fd9\u6bb5\u4ee3\u7801\u79fb\u52a8\u5230head\u6807\u7b7e\u5185\u540e\uff0c\u6d4f\u89c8\u5668\u5c06\u5728\u52a0\u8f7d\u9875\u9762\u5176\u4ed6\u5185\u5bb9\u4e4b\u524d\u6267\u884c\u5b83\uff0c\u4ece\u800c\u907f\u514d\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5bf9\u5df2\u663e\u793a\u9875\u9762\u7684\u5f71\u54cd\u3002<\/p>\n<p><strong>\u53c2\u8003\uff1a<\/strong><\/p>\n<ul>\n<li>[amfe\/lib-flexible at master](https:\/\/hub.com\/amfe\/lib-flexible\/blob\/master\/src\/index.js)<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u5982\u4f55\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684CSS\u626d\u66f2\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>\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684\u626d\u66f2 \u5728\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u4f7f\u7528rem\u8ba1\u7b97\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u53ef\u4ee5\u5b9e\u73b0\u81ea\u9002\u5e94\u5e03\u5c40\u3002\u4f46\u662f\uff0c\u6b64\u65b9\u6cd5\u53ef\u80fd\u4f1a\u5bfc\u81f4\u9875\u9762\u6253\u5f00\u65f6\u51fa\u73b0css\u626d\u66f2\uff0c\u8fd9\u662f\u56e0\u4e3a\u9875\u9762\u5185\u5bb9\u5728\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8d4b\u503c\u540e\u91cd\u65b0\u6e32\u67d3\u9020\u6210\u7684\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u8981\u907f\u514d\u8fd9\u79cd\u60c5\u51b5\uff0c\u5c06\u8ba1\u7b97\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u7684js\u811a\u672c\u79fb\u52a8\u5230\u9875\u9762\u7684\u6700\u524d\u9762\uff0c\u5373head\u6807\u7b7e\u5185\u3002 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u539f\u56e0\uff1a \u5f53\u6d4f\u89c8\u5668\u52a0\u8f7d\u9875\u9762\u65f6\uff0c\u5b83\u4f1a\u6309\u7167\u987a\u5e8f\u6267\u884c\u9875\u9762\u4e2d\u7684\u4ee3\u7801\u3002\u5982\u679c\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u7684js\u811a\u672c\u4f4d\u4e8e\u9875\u9762\u5e95\u90e8\uff0c\u5f53\u6d4f\u89c8\u5668\u8fd0\u884c\u5230\u8be5\u4ee3\u7801\u65f6\uff0c\u9875\u9762\u5185\u5bb9\u5df2\u7ecf\u52a0\u8f7d\u5e76\u663e\u793a\u4e86\u3002\u968f\u540e\uff0c\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8d4b\u503c\u4f1a\u89e6\u53d1\u9875\u9762\u91cd\u65b0\u6e32\u67d3\uff0c\u4ece\u800c\u5bfc\u81f4css\u626d\u66f2\u3002 \u793a\u4f8b\uff1a &lt;head&gt; &lt;!&#8211; \u79fb\u52a8\u7aef\u81ea\u9002\u5e94\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97 &#8211;&gt; &lt;script&gt; (function () { const rootFontSize = 16; document.documentElement.style.fontSize = rootFontSize + &#8220;px&#8221;; })(); &lt;\/script&gt; &lt;\/head&gt; \u767b\u5f55\u540e\u590d\u5236 \u5c06\u8fd9\u6bb5\u4ee3\u7801\u79fb\u52a8\u5230head\u6807\u7b7e\u5185\u540e\uff0c\u6d4f\u89c8\u5668\u5c06\u5728\u52a0\u8f7d\u9875\u9762\u5176\u4ed6\u5185\u5bb9\u4e4b\u524d\u6267\u884c\u5b83\uff0c\u4ece\u800c\u907f\u514d\u6839\u8282\u70b9\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5bf9\u5df2\u663e\u793a\u9875\u9762\u7684\u5f71\u54cd\u3002 \u53c2\u8003\uff1a [amfe\/lib-flexible at master](https:\/\/hub.com\/amfe\/lib-flexible\/blob\/master\/src\/index.js) \u4ee5\u4e0a\u5c31\u662f\u79fb\u52a8\u7aef\u9879\u76ee\u4e2d\uff0c\u5982\u4f55\u6d88\u9664rem\u5b57\u4f53\u5927\u5c0f\u8ba1\u7b97\u5e26\u6765\u7684CSS\u626d\u66f2\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-25978","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25978","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=25978"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/25978\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=25978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=25978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=25978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}