{"id":2113,"date":"2018-11-28T14:20:15","date_gmt":"2018-11-28T06:20:15","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2113"},"modified":"2018-11-28T14:23:47","modified_gmt":"2018-11-28T06:23:47","slug":"rem%e4%b8%8eem%e7%9a%84%e4%bd%bf%e7%94%a8%e5%92%8c%e5%8c%ba%e5%88%ab%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2113.html","title":{"rendered":"rem\u4e0eem\u7684\u4f7f\u7528\u548c\u533a\u522b\u8be6\u89e3"},"content":{"rendered":"
\u7f16\u8005\uff1a\u5728\u81ea\u9002\u5e94<\/span>\u5236\u4f5c\u7a3f\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230rem<\/span>\u548cem\u8fd9\u4e24\u4e2a\u5355\u4f4d\u7684\u5192\u6ce1\uff0crem<\/span>\u662f\u57fa\u4e8ehtml\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u6765\u51b3\u5b9a\uff0c\u800cem\u5219\u6839\u636e\u4f7f\u7528\u5b83\u7684\u5143\u7d20\u7684\u5927\u5c0f\u51b3\u5b9a\uff08\u5f88\u591a\u4eba\u9519\u8bef\u4ee5\u4e3a\u662f\u6839\u636e\u7236\u7c7b\u5143\u7d20\uff0c\u5b9e\u9645\u4e0a\u662f\u4f7f\u7528\u5b83\u7684\u5143\u7d20\u7ee7\u627f\u4e86\u7236\u7c7b\u7684\u5c5e\u6027\u624d\u4f1a\u4ea7\u751f\u7684\u9519\u89c9\uff09<\/p>\n \u4f60\u53ef\u80fd\u5df2\u7ecf\u5f88\u719f\u7ec3\u4f7f\u7528\u8fd9\u4e24\u4e2a\u7075\u6d3b\u7684\u5355\u4f4d\uff0c\u4f46\u4f60\u53ef\u80fd\u4e0d\u5b8c\u5168\u4e86\u89e3\u4f55\u65f6\u4f7f\u7528 rem<\/span> \uff0c\u4f55\u65f6\u4f7f\u7528 em\u3002 \u672c\u6559\u7a0b\u5c06\u5e2e\u4f60\u5f04\u6e05\u695a!<\/p>\n Em \u548c rem\u90fd\u662f\u7075\u6d3b\u3001 \u53ef\u6269\u5c55\u7684\u5355\u4f4d\uff0c\u7531\u6d4f\u89c8\u5668\u8f6c\u6362\u4e3a\u50cf\u7d20\u503c\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u7684\u8bbe\u8ba1\u4e2d\u7684\u5b57\u4f53\u5927\u5c0f\u8bbe\u7f6e\u3002 \u5982\u679c\u4f60\u4f7f\u7528\u503c 1em \u6216 1rem\uff0c\u5b83\u53ef\u4ee5\u88ab\u6d4f\u89c8\u5668\u7ffb\u8bd1\u6210 \u4ece16px\u5230 160px \u6216\u5176\u4ed6\u4efb\u610f\u503c\u3002<\/p>\n CSS<\/a><\/span> \u8fb9\u8ddd\u8bbe\u7f6e\u4e3a 1em<\/p>\n \u6d4f\u89c8\u5668\u7ffb\u8bd1\u621016px<\/p>\n CSS padding\u8bbe\u4e3a 16px<\/p>\n \u6d4f\u89c8\u5668\u7ffb\u8bd1\u6210160px \u6ed1\u52a8\u6ed1\u5757\u8bd5\u8bd5\u8fd9\u4e2a CodePen \u4f8b\u5b50\uff0c\u4f60\u53ef\u4ee5\u770b\u5230rem \u548c em \u5355\u4f4d\u7684\u503c\u53ef\u4ee5\u8f6c\u5316\u4e3a\u4e0d\u540c\u7684\u50cf\u7d20\u503c\uff0c\u800c px \u5355\u4f4d\u4fdd\u6301\u56fa\u5b9a\u5927\u5c0f:<\/p>\n \u4f7f\u7528 em \u548c rem \u5355\u4f4d\u53ef\u4ee5\u8ba9\u6211\u4eec\u7684\u8bbe\u8ba1\u66f4\u52a0\u7075\u6d3b\uff0c\u80fd\u591f\u63a7\u5236\u5143\u7d20\u6574\u4f53\u653e\u5927\u7f29\u5c0f\uff0c\u800c\u4e0d\u662f\u56fa\u5b9a\u5927\u5c0f\u3002 \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u8fd9\u79cd\u7075\u6d3b\u6027\uff0c\u4f7f\u6211\u4eec\u5728\u5f00\u53d1\u671f\u95f4\uff0c\u80fd\u66f4\u52a0\u5feb\u901f\u7075\u6d3b\u7684\u8c03\u6574\uff0c\u5141\u8bb8\u6d4f\u89c8\u5668\u7528\u6237\u8c03\u6574\u6d4f\u89c8\u5668\u5927\u5c0f\u6765\u8fbe\u5230\u6700\u4f73\u4f53\u9a8c\u3002<\/p>\n Em \u548c rem \u5355\u4f4d\u63d0\u4f9b\u7684\u8fd9\u79cd\u7075\u6d3b\u6027\u548c\u5de5\u4f5c\u65b9\u5f0f\u90fd\u5f88\u76f8\u4f3c\uff0c\u6240\u4ee5\u6700\u5927\u7684\u95ee\u9898\u662f\uff0c\u6211\u4eec\u4f55\u65f6\u5e94\u4f7f\u7528 em \u503c\uff0c\u4f55\u65f6\u5e94\u4f7f\u7528 rem \u503c\u5462?<\/p>\n Em \u548c rem \u5355\u4f4d\u4e4b\u95f4\u7684\u533a\u522b\u662f\u6d4f\u89c8\u5668\u6839\u636e\u8c01\u6765\u8f6c\u5316\u6210px\u503c \u7406\u89e3\u8fd9\u79cd\u5dee\u5f02\u662f\u51b3\u5b9a\u4f55\u65f6\u4f7f\u7528\u54ea\u4e2a\u5355\u5143\u7684\u5173\u952e\u3002<\/p>\n \u6211\u4eec\u8981\u901a\u8fc7\u590d\u4e60 rem \u548c em \u5355\u4f4d\u5982\u4f55\u5de5\u4f5c\uff0c\u6765\u786e\u4fdd\u4f60\u77e5\u9053\u6bcf\u4e00\u4e2a\u7ec6\u8282\u3002 \u7136\u540e\u6211\u4f1a\u8bb2\u5230\u4e3a\u4ec0\u4e48\u4f60\u5e94\u8be5\u4f7f\u7528 em \u6216 rem \u7684\u5355\u4f4d\u3002<\/p>\n \u6700\u540e\uff0c\u6211\u4eec\u4f1a\u770b\u770b\u5230\u5e95\u54ea\u4e9b\u5178\u578b\u5143\u7d20\u7684\u8bbe\u8ba1\uff0c\u4f60\u5e94\u8be5\u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u4f7f\u7528\u54ea\u79cd\u7c7b\u578b\u7684\u5355\u4f4d\u3002<\/p>\n \u5f53\u4f7f\u7528 rem \u5355\u4f4d\uff0c\u4ed6\u4eec\u8f6c\u5316\u4e3a\u50cf\u7d20\u5927\u5c0f\u53d6\u51b3\u4e8e\u9875\u6839\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u5373 html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u4e58\u4ee5\u4f60 rem \u503c\u3002<\/p>\n \u4f8b\u5982\uff0c\u6839\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f 16px\uff0c10rem \u5c06\u7b49\u540c\u4e8e 160px\uff0c\u5373 10 x 16 = 160\u3002<\/p>\n CSS padding\u8bbe\u7f6e\u4e3a 10rem<\/p>\n \u8ba1\u7b97\u7ed3\u679c\u4e3a160px<\/p>\n \u5f53\u4f7f\u7528em\u5355\u4f4d\u65f6\uff0c\u50cf\u7d20\u503c\u5c06\u662fem\u503c\u4e58\u4ee5\u4f7f\u7528em\u5355\u4f4d\u7684\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u4f8b\u5982\uff0c\u5982\u679c\u4e00\u4e2a div \u6709 18px \u5b57\u4f53\u5927\u5c0f\uff0c10em \u5c06\u7b49\u540c\u4e8e 180px\uff0c\u5373 10 \u00d7 18 = 180\u3002<\/p>\n CSS padding\u8bbe\u7f6e\u4e3a 10em<\/p>\n \u8ba1\u7b97\u5230 180px (\u6216\u63a5\u8fd1\u5b83)<\/p>\n \u6709\u4e00\u4e2a\u6bd4\u8f83\u666e\u904d\u7684\u8bef\u89e3\uff0c\u8ba4\u4e3a em \u5355\u4f4d\u662f\u76f8\u5bf9\u4e8e\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u4e8b\u5b9e\u4e0a\uff0c\u6839\u636eW3\u6807\u51c6 \uff0c\u5b83\u4eec\u662f\u76f8\u5bf9\u4e8e\u4f7f\u7528em\u5355\u4f4d\u7684\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u53ef\u4ee5\u5f71\u54cd em \u503c\uff0c\u4f46\u8fd9\u79cd\u60c5\u51b5\u7684\u53d1\u751f\uff0c\u7eaf\u7cb9\u662f\u56e0\u4e3a\u7ee7\u627f\u3002 \u8ba9\u6211\u4eec\u770b\u770b\u4e3a\u4ec0\u4e48\u4ee5\u53ca\u5982\u4f55\u8d77\u4f5c\u7528\u3002<\/p>\n \u4f7f\u7528 em \u5355\u4f4d\u5b58\u5728\u7ee7\u627f\u7684\u65f6\u5019\uff0c\u60c5\u51b5\u4f1a\u53d8\u5f97\u6bd4\u8f83\u68d8\u624b\uff0c\u56e0\u4e3a\u6bcf\u4e2a\u5143\u7d20\u5c06\u81ea\u52a8\u7ee7\u627f\u5176\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u7ee7\u627f\u6548\u679c\u53ea\u80fd\u88ab\u660e\u786e\u7684\u5b57\u4f53\u5355\u4f4d\u8986\u76d6\uff0c\u6bd4\u5982px,vw<\/p>\n \u4f7f\u7528 em \u5355\u4f4d\u7684\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u6839\u636e\u5b83\u4eec\u6765\u5b9a\u3002 \u4f46\u8be5\u5143\u7d20\u53ef\u80fd\u7ee7\u627f\u5176\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u800c\u7236\u5143\u7d20\u53c8\u7ee7\u627f\u5176\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u7b49\u7b49\u3002 \u56e0\u6b64\uff0c\u4ee5 em \u4e3a\u5355\u4f4d\u7684\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u53ef\u80fd\u4f1a\u53d7\u5230\u5176\u4efb\u4f55\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u5f71\u54cd\u3002<\/p>\n \u8ba9\u6211\u4eec\u770b\u770b\u4e00\u4e2a\u4f8b\u5b50\u3002 \u5728\u4e0b\u9762\u7684 CodePen\u5355\u6b65\u6267\u884c\u8bd5\u8bd5\u3002 \u968f\u7740\u4f60\u7684\u524d\u8fdb\uff0c\u4f7f\u7528 Chrome \u5f00\u53d1\u5de5\u5177\u6216 Firebug \u4e3a\u706b\u72d0\u6d4f\u89c8\u5668\u6765\u68c0\u67e5\u6211\u4eec\u7684 em \u5355\u4f4d\u8ba1\u7b97\u5230\u7684\u50cf\u7d20\u503c\u3002<\/p>\n \u5982\u679c\u6211\u4eec\u7684\u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u4e3a 16px (\u901a\u5e38\u662f\u9ed8\u8ba4\u503c) \u4e00\u4e2a\u5b50\u5143\u7d20 div \u91cc\u9762padding\u503c\u4e3a 1.5em\uff0c\u8be5 div \u5c06\u4ece\u6839\u5143\u7d20\u7ee7\u627f\u5b57\u4f53\u5927\u5c0f 16px\u3002 \u56e0\u6b64padding\u4f1a\u7ffb\u8bd1\u6210 24px\uff0c\u5373 1.5 x 16 = 24\u3002<\/p>\n \u5982\u679c\u6211\u4eec\u52a0\u591a\u4e00\u4e2adiv\u6765\u5305\u88f9\u539f\u5148\u7684div\uff0c\u7136\u540e\u8bbe\u7f6e\u5176\u5b57\u4f53\u5927\u5c0f\u4e3a 1.25em\u5462?<\/p>\n \u6211\u4eec\u5305\u88f9\u7684 div \u7ee7\u627f\u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f 16px \uff0c\u5e76\u4e58\u4ee5\u5b83\u81ea\u5df1\u7684 1.25em \u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u8fd9\u5c06\u8bbe\u7f6e\u5305\u88f9 div \u5b57\u4f53\u5927\u5c0f\u4e3a 20px\uff0c\u5373 1.25 x 16 = 20\u3002<\/p>\n \u73b0\u5728\u6211\u4eec\u539f\u59cb\u7684 div \u4e0d\u518d\u76f4\u63a5\u4ece\u6839\u5143\u7d20\u7ee7\u627f,\u800c\u662f\u4ece\u5176\u65b0\u7684\u7236\u5143\u7d20\u7ee7\u627f\u5b57\u4f53\u5927\u5c0f\u4e3a 20px 1.5em \u5176padding\u503c\u73b0\u5728\u7b49\u4e8e 30px\uff0c\u5373 1.5 x 20 = 30\u3002<\/p>\n \u8fd9\u4e2a\u7ee7\u627f\u6548\u5e94\u53ef\u4ee5\u66f4\u590d\u6742\uff0c\u5982\u679c\u6211\u4eec\u5411\u6211\u4eec\u539f\u59cb\u7684 div \u6dfb\u52a0 em \u5b57\u4f53\u5355\u4f4d\uff0c\u6bd4\u65b9\u8bf4 1.2em\u3002<\/p>\n Div \u4ece\u5176\u7236\u7ea7\u7ee7\u627f 20px \u5b57\u4f53\u5927\u5c0f\uff0c\u7136\u540e\uff0c\u4e58\u4ee5\u5b83\u81ea\u5df1\u7684 1.2em \u8bbe\u7f6e\uff0c\u7ed9\u5b83 24px\uff0c\u5373 1.2 \u00d7 20 = 24 \u65b0\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n div\u4e0a\u76841.5em padding \u73b0\u5728\u5c06\u518d\u6b21\u6539\u53d8\u5927\u5c0f\uff0c\u7528\u65b0\u7684\u5b57\u4f53\u5927\u5c0f\uff0c36px\uff0c\u5373 1.5 \u00d7 24 = 36 \u3002<\/p>\n \u6700\u540e\uff0c\u4e3a\u4e86\u8fdb\u4e00\u6b65\u8bf4\u660e\u90a3\u4e2a em \u5355\u4f4d\u662f\u76f8\u5bf9\u4e8e\u4ed6\u4eec\u6700\u7ec8\u83b7\u5f97(\u4e0d\u662f\u7236\u5143\u7d20)\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u8ba9\u6211\u4eec\u6765\u770b\u770b\u8bbe\u7f6epadding 1.5em \u5982\u679c\u6211\u4eec\u663e\u5f0f\u8bbe\u7f6e div \u4f7f\u7528 14px\u503c\uff0c\u4e0d\u7ee7\u627f\u5b57\u4f53\u5927\u5c0f\u4f1a\u53d1\u751f\u4ec0\u4e48\u3002<\/p>\n \u73b0\u5728\uff0c\u6211\u4eec\u7684padding\u4e3a 21px\uff0c\u5373 1.5 x 14 = 21 \u5df2\u7ecf\u53d8\u5c0f\u4e86\u3002 \u5b83\u4e0d\u53d7\u7236\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u7531\u4e8e\u5b58\u5728\u7740\u8fd9\u4e9b\u9690\u60a3\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u4e3a\u4ec0\u4e48\u5fc5\u987b\u77e5\u9053\u5982\u4f55\u6b63\u786e\u7ba1\u7406\u4f7f\u7528 em \u5355\u4f4d\u3002<\/p>\n \u9ed8\u8ba4\u60c5\u51b5\u4e0b\u6d4f\u89c8\u5668\u901a\u5e38\u6709\u5b57\u4f53\u5927\u5c0f 16px\uff0c\u4f46\u8fd9\u53ef\u4ee5\u88ab\u7528\u6237\u66f4\u6539\u4e3a\u4ece 9px \u5230 72px\u7684\u4efb\u4f55\u503c<\/p>\n \u6839 html \u5143\u7d20\u5c06\u7ee7\u627f\u6d4f\u89c8\u5668\u4e2d\u8bbe\u7f6e\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u9664\u975e\u663e\u5f0f\u8bbe\u7f6e\u56fa\u5b9a\u503c\u53bb\u8986\u76d6\u3002<\/p>\n \u6240\u4ee5 html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u867d\u7136\u662f\u76f4\u63a5\u786e\u5b9a rem \u503c\uff0c\u4f46\u5b57\u4f53\u5927\u5c0f\u53ef\u80fd\u9996\u5148\u6765\u81ea\u6d4f\u89c8\u5668\u8bbe\u7f6e\u3002<\/p>\n \u56e0\u6b64\u6d4f\u89c8\u5668\u7684\u5b57\u4f53\u5927\u5c0f\u8bbe\u7f6e\u53ef\u4ee5\u5f71\u54cd\u6bcf\u4e2a\u4f7f\u7528 rem \u5355\u5143\u4ee5\u53ca\u6bcf\u4e2a\u901a\u8fc7 em \u5355\u4f4d\u7ee7\u627f\u7684\u503c\u3002<\/p>\n \u9664\u975e\u91cd\u5199\uff0c\u5426\u5219\u5b83\u5c06\u7ee7\u627f\u6d4f\u89c8\u5668\u9ed8\u8ba4\u8bbe\u7f6e\u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u4f8b\u5982\uff0c\u8ba9\u6211\u4eec\u628a\u7f51\u7ad9\u7684html\u5143\u7d20\u6ca1\u6709\u8bbe\u7f6efont-size\u503c\u3002<\/p>\n \u5982\u679c\u7528\u6237\u8ba9\u4ed6\u4eec\u7684\u6d4f\u89c8\u5668\u9ed8\u8ba4\u5b57\u4f53\u5927\u5c0f\u4e3a 16px\uff0c\u90a3\u4e48\u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u5c06\u4e3a 16px\u3002 \u5728 Chrome \u5f00\u53d1\u5de5\u5177\u4e0b\uff0c\u4f60\u53ef\u4ee5\u5728\u5df2\u8ba1\u7b97\u9009\u9879\u5361\u4e0b\u770b\u5230\u4e00\u4e2a\u5143\u7d20\u7ee7\u627f\u7684\u5c5e\u6027\u3002<\/p>\n \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b 10rem \u7b49\u4e8e 160px\uff0c\u5373 10 x 16 = 160\u3002<\/p>\n \u5982\u679c\u7528\u6237\u5c06\u5176\u6d4f\u89c8\u5668\u4e2d\u7684\u9ed8\u8ba4\u5b57\u4f53\u5927\u5c0f\u8c03\u4e3a18px\uff0c\u6839\u5b57\u4f53\u5927\u5c0f\u53d8\u6210 18px\u3002 \u73b0\u5728 10rem \u8f6c\u6362\u4e3a 180px\uff0c\u5373 10 \u00d7 18 = 180\u3002<\/p>\n \u5f53 em \u5355\u4f4d\u8bbe\u7f6e\u5728 html \u5143\u7d20\u4e0a\u65f6\uff0c\u5b83\u5c06\u8f6c\u6362\u4e3aem\u503c\u4e58\u4ee5\u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f\u7684\u8bbe\u7f6e\u3002<\/p>\n \u4f8b\u5982\uff0c\u5982\u679c\u7f51\u7ad9\u7684 html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u5c5e\u6027\u8bbe\u7f6e\u4e3a 1.25em\uff0c\u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u5c06\u4e3a 1.25 \u500d\u7684\u6d4f\u89c8\u5668\u7684\u5b57\u4f53\u5927\u5c0f\u8bbe\u7f6e\u3002<\/p>\n \u5982\u679c\u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f\u88ab\u8bbe\u7f6e\u4e3a 16px\uff0c\u6839\u5b57\u4f53\u5927\u5c0f\u4f1a\u51fa\u6765\u4e3a 20px\uff0c\u5373 1.25 x 16 = 20\u3002<\/p>\n \u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b 10rem \u5c06\u7b49\u4e8e 200px\uff0c\u5373 10 \u00d7 20 = 200\u3002<\/p>\n \u6240\u4ee5\uff0c\u5982\u679c\u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f\u88ab\u8bbe\u7f6e\u4e3a 20px\uff0c\u6839\u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u4f1a\u7ffb\u8bd1\u6210 25px\uff0c\u5373 1.25 \u00d7 20 = 25\u3002<\/p>\n \u73b0\u5728 10rem \u5c06\u7b49\u4e8e 250px\uff0c\u5373 10 \u00d7 25 = 250\u3002<\/p>\n \u4e0a\u8ff0\u6240\u6709\u5f52\u7ed3\u5982\u4e0b:<\/p>\n Rem \u5355\u4f4d\u63d0\u4f9b\u6700\u4f1f\u5927\u7684\u529b\u91cf\u5e76\u4e0d\u4ec5\u4ec5\u662f\u4ed6\u4eec\u63d0\u4f9b\u4e00\u81f4\u5c3a\u5bf8\u800c\u4e0d\u662f\u7ee7\u627f\u3002 \u76f8\u53cd\uff0c\u5b83\u7ed9\u6211\u4eec\u7684\u4e00\u4e2a\u9014\u7ecf\u53bb\u83b7\u53d6\u7528\u6237\u7684\u504f\u597d\u6765\u5f71\u54cd\u7f51\u7ad9\u4e2d\u6bcf\u4e00\u5904\u4f7f\u7528rem\u7684\u5143\u7d20\u5927\u5c0f\uff0c\u4e0d\u518d\u662f\u4f7f\u7528\u56fa\u5b9a\u7684 px \u5355\u4f4d\u3002<\/p>\n \u4e3a\u6b64\uff0c\u4f7f\u7528 rem \u5355\u4f4d\u7684\u4e3b\u8981\u76ee\u7684\u5e94\u8be5\u662f\u786e\u4fdd\u65e0\u8bba\u7528\u6237\u5982\u4f55\u8bbe\u7f6e\u81ea\u5df1\u7684\u6d4f\u89c8\u5668\uff0c\u6211\u4eec\u7684\u5e03\u5c40\u90fd\u80fd\u8c03\u6574\u5230\u5408\u9002\u5927\u5c0f\u3002<\/p>\n \u4e00\u4e2a\u7ad9\u70b9\u6700\u521d\u8bbe\u8ba1\u53ef\u4ee5\u4e13\u6ce8\u4e8e\u6700\u5e38\u89c1\u7684\u9ed8\u8ba4\u6d4f\u89c8\u5668\u4e2d\u5b57\u4f53\u5927\u5c0f 16px\u3002<\/p>\n \u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f 16px<\/p>\n \u4f46\u662f\uff0c\u901a\u8fc7\u4f7f\u7528 rem \u5355\u4f4d\uff0c\u5982\u679c\u7528\u6237\u8c03\u6574\u5176\u5b57\u4f53\u5927\u5c0f\uff0c\u6211\u4eec\u4e5f\u80fd\u4fdd\u8bc1\u5e03\u5c40\u7684\u5b8c\u6574\u6027\uff0c\u4f7f\u7528\u8f83\u5c0f\u7684\u6587\u672c\u907f\u514d\u6587\u672c\u7a7a\u95f4\u88ab\u538b\u6241\u4e86\u3002<\/p>\n \u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f 34px<\/p>\n \u5982\u679c\u7528\u6237\u7f29\u5c0f\u5176\u5b57\u4f53\u5927\u5c0f\uff0c\u6574\u4e2a\u5e03\u5c40\u6389\u4e0b\u6765\uff0c\u7a7a\u767d\u533a\u57df\u4e2d\u7684\u6587\u672c\u4e5f\u4e0d\u4f1a\u60f3\u5f97\u5f88\u65e0\u529b\u3002<\/p>\n \u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f 9px<\/p>\n \u7528\u6237\u4f1a\u56e0\u4e3a\u5404\u79cd\u5404\u6837\u7684\u539f\u56e0\u66f4\u6539\u5b57\u4f53\u5927\u5c0f\u8bbe\u7f6e\u3002 \u5bb9\u7eb3\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u83b7\u5f97\u66f4\u597d\u7684\u7528\u6237\u4f53\u9a8c\u3002<\/p>\n \u4e00\u4e9b\u8bbe\u8ba1\u5e08\u4f7f\u7528\u7ed3\u5408 rem \u5355\u4f4d\u7684\u65b9\u5f0f\u7ed9html\u5143\u7d20\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u56fa\u5b9a\u7684px\u5355\u4f4d\u3002 \u8fd9\u662f\u5f88\u666e\u904d\u7684\u505a\u6cd5\uff0c\u6240\u4ee5\u6539\u53d8html\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u65f6\uff0c\u53ef\u4ee5\u4f7f\u6574\u4e2a\u9875\u9762\u505a\u76f8\u5e94\u8c03\u6574<\/p>\n \u6211\u5f3a\u70c8\u53cd\u5bf9\u79cd\u505a\u6cd5\uff0c\u56e0\u4e3a\u5b83\u91cd\u5199\u7ee7\u627f\u4e86\u7528\u6237\u8bbe\u7f6e\u7684\u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f\u3002 \u66f4\u5938\u5f20\u7684\u8bf4\uff0c\u8fd9\u5265\u524a\u4e86\u7528\u6237\u81ea\u884c\u8c03\u6574\u4ee5\u83b7\u5f97\u6700\u4f73\u89c6\u89c9\u6548\u679c\u7684\u80fd\u529b\u3002<\/p>\n \u5982\u679c\u60a8\u786e\u5b9e\u9700\u8981\u66f4\u6539 html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u90a3\u4e48\u5c31\u4f7f\u7528em\uff0crem\u5355\u4f4d\uff0c\u8fd9\u6837\u6839\u5143\u7d20\u7684\u503c\u8fd8\u4f1a\u662f\u7528\u6237\u6d4f\u89c8\u5668\u5b57\u4f53\u5927\u5c0f\u7684\u4e58\u79ef\u3002<\/p>\n \u8fd9\u5c06\u5141\u8bb8\u60a8\u901a\u8fc7\u66f4\u6539\u60a8\u7684 html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u8c03\u6574\u4f60\u7684\u8bbe\u8ba1\uff0c\u4f46\u4ecd\u4f1a\u4fdd\u7559\u7528\u6237\u7684\u6d4f\u89c8\u5668\u8bbe\u7f6e\u7684\u6548\u679c\u3002<\/p>\n em \u5355\u4f4d\u53d6\u51b3\u4e8e\u4e00\u4e2afont-size\u503c\u800c\u975e html \u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u4e3a\u6b64\uff0cem \u5355\u4f4d\u7684\u4e3b\u8981\u76ee\u7684\u5e94\u8be5\u662f\u5141\u8bb8\u4fdd\u6301\u5728\u4e00\u4e2a\u7279\u5b9a\u7684\u8bbe\u8ba1\u5143\u7d20\u8303\u56f4\u5185\u7684\u53ef\u6269\u5c55\u6027\u3002<\/p>\n \u4f8b\u5982\uff0c\u60a8\u53ef\u80fd\u4f7f\u7528em \u503c\u8bbe\u7f6e\u5bfc\u822a\u83dc\u5355\u9879\u7684padding\u3001 margin\uff0cline-height\u7b49\u503c\u3002<\/p>\n \u5e26\u67090.9rem \u5b57\u4f53\u5927\u5c0f\u7684\u83dc\u5355<\/p>\n \u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5982\u679c\u60a8\u66f4\u6539\u83dc\u5355\u7684\u5b57\u4f53\u5927\u5c0f\u83dc\u5355\u9879\u5468\u56f4\u7684\u95f4\u8ddd\u5c06\u5728\u5269\u4f59\u7684\u7a7a\u95f4\u6309\u6bd4\u4f8b\u7f29\u653e\u3002<\/p>\n \u5e26\u67091.2rem \u5b57\u4f53\u5927\u5c0f\u7684\u83dc\u5355<\/p>\n \u524d\u9762\u4e00\u8282\u4e2d\u4f60\u770b\u5230\u8ddf\u8e2a em \u5355\u4f4d\u5982\u4f55\u53d8\u5f97\u4e0d\u53ef\u6536\u62fe\u3002 \u4e3a\u6b64\uff0c\u6211\u5efa\u8bae\u53ea\u5728\u4f60\u6807\u8bc6\u6e05\u695a\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528 em \u5355\u4f4d\u3002<\/p>\n \u4e00\u4e9b web<\/span> \u8bbe\u8ba1\u5e08\u4e4b\u95f4\u5b58\u5728\u8fa9\u8bba\uff0c\u6211\u76f8\u4fe1\u4e0d\u540c\u7684\u4eba\u6709\u4e0d\u540c\u7684\u9996\u9009\u7684\u65b9\u6cd5\uff0c\u4f46\u6211\u7684\u5efa\u8bae\u662f\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n \u6839\u636e\u67d0\u4e2a\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u505a\u7f29\u653e\u800c\u4e0d\u662f\u6839\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u4e00\u822c\u6765\u8bf4\uff0c\u4f60\u9700\u8981\u4f7f\u7528 em \u5355\u4f4d\u7684\u552f\u4e00\u539f\u56e0\u662f\u7f29\u653e\u6ca1\u6709\u9ed8\u8ba4\u5b57\u4f53\u5927\u5c0f\u7684\u5143\u7d20\u3002<\/p>\n \u6839\u636e\u6211\u4eec\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u8bbe\u8ba1\u7ec4\u4ef6\u6bd4\u5982\u6309\u94ae\uff0c\u83dc\u5355\u548c\u6807\u9898\u53ef\u80fd\u4f1a\u6709\u81ea\u5df1\u660e\u786e\u7684\u5b57\u4f53\u5927\u5c0f\u3002 \u5f53\u4f60\u4fee\u6539\u5b57\u4f53\u5927\u5c0f\u7684\u65f6\u5019\uff0c\u4f60\u5e0c\u671b\u6574\u4e2a\u7ec4\u4ef6\u90fd\u9002\u5f53\u7f29\u653e<\/p>\n \u901a\u7528\u5c5e\u6027\u8fd9\u4e00\u51c6\u5219\u5c06\u9002\u7528\u4e8e\u5728\u975e\u9ed8\u8ba4\u5b57\u4f53\u5927\u5c0f\u7684\u5143\u7d20\u4e0a\u7684padding\u3001 margin\u3001 width\u3001 height\u548cline-height\u7b49\u503c\u3002<\/p>\n \u6211\u5efa\u8bae\uff0c\u5f53\u60a8\u4f7f\u7528 em \u5355\u4f4d\uff0c\u4ed6\u4eec\u4f7f\u7528\u7684\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u5e94\u8bbe\u7f6e\u5bf9rem\u5355\u4f4d\uff0c\u4ee5\u4fdd\u7559\u7684\u53ef\u6269\u5c55\u6027\uff0c\u4f46\u907f\u514d\u7ee7\u627f\u6df7\u6dc6\u3002<\/p>\n \u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230\u4f7f\u7528em\u4f5c\u4e3a\u5b57\u4f53\u5927\u5c0f\u5355\u4f4d\uff0c\u7279\u522b\u662f\u6807\u9898\uff0c\u5f53\u6211\u8ba4\u4e3a\u5982\u679c\u4f7f\u7528rem\u5c06\u66f4\u5177\u53ef\u6269\u5c55\u6027\u3002<\/p>\n \u6807\u9898\u7ecf\u5e38\u4f7f\u7528 em \u5355\u4f4d\u7684\u539f\u56e0\u662f\u4ed6\u4eec\u76f8\u6bd4px\u5355\u4f4d\uff0c\u5728\u76f8\u5bf9\u5e38\u89c4\u6587\u672c\u5927\u5c0f\u65b9\u9762\u66f4\u51fa\u8272\u3002 \u7136\u800c rem \u5355\u4f4d\u540c\u6837\u4e5f\u53ef\u4ee5\u5b9e\u73b0\u8fd9\u4e00\u76ee\u6807\u3002 \u5982\u679c html \u5143\u7d20\u4e0a\u4efb\u4f55\u5b57\u4f53\u5927\u5c0f\u8c03\u6574\uff0c\u6807\u9898\u5927\u5c0f\u4ecd\u4f1a\u7f29\u653e\u3002<\/p>\n \u8bf7\u5c1d\u8bd5\u66f4\u6539\u4e0b\u9762\u7684 CodePen\uff0c\u770b\u770b html \u5143\u7d20\u4e0a\u7684 em \u5b57\u4f53\u5927\u5c0f\u5982\u4f55\u8d77\u4f5c\u7528:<\/p>\n \u5c11\u90e8\u5206\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e0d\u60f3\u6211\u4eec\u7684\u5b57\u4f53\u5927\u5c0f\u6839\u636e\u6839\u5143\u7d20\u505a\u8c03\u6574\uff0c\u53ea\u6709\u51e0\u4e2a\u4f8b\u5916\u7684\u60c5\u51b5\u3002<\/p>\n \u6211\u4eec\u53ef\u4ee5\u60f3\u5230\u7684\u4f8b\u5b50\u662f\u4e00\u4e2a\u4f7f\u7528 em \u5b57\u4f53\u5927\u5c0f\u7684\u4e0b\u62c9\u83dc\u5355\uff0c\u6211\u4eec\u6709\u7b2c\u4e8c\u4e2a\u7ea7\u522b\u7684\u83dc\u5355\u9879\u6587\u672c\u5927\u5c0f\u53d6\u51b3\u4e8e\u7b2c\u4e00\u7ea7\u5b57\u4f53\u5927\u5c0f\u3002 \u53e6\u4e00\u4e2a\u4f8b\u5b50\u53ef\u80fd\u662f\u7528\u5728\u6309\u94ae\u91cc\u9762\u7684\u5b57\u4f53\u56fe\u6807\uff0c\u5b57\u4f53\u56fe\u6807\u7684\u5927\u5c0f\u8ddf\u6309\u94ae\u7684\u6587\u672c\u5927\u5c0f\u6709\u5173\u3002<\/p>\n \u7136\u800c\uff0c\u5927\u591a\u6570 web \u8bbe\u8ba1\u4e2d\u7684\u5143\u7d20\u5f80\u5f80\u4e0d\u4f1a\u6709\u8fd9\u79cd\u7c7b\u578b\u7684\u8981\u6c42\uff0c\u6240\u4ee5\u4e00\u822c\u4f7f\u7528 rem \u5355\u4f4d\u7684\u5b57\u4f53\u5927\u5c0f\uff0cem \u5355\u4f4d\u53ea\u5728\u7279\u6b8a\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u3002<\/p>\n \u4e0d\u9700\u8981 em \u5355\u4f4d\uff0c\u5e76\u4e14\u6839\u636e\u6d4f\u89c8\u5668\u7684\u5b57\u4f53\u5927\u5c0f\u8bbe\u7f6e\u7f29\u653e\u7684\u4efb\u4f55\u5c3a\u5bf8\u3002<\/p>\n \u8fd9\u51e0\u4e4e\u5728\u4e00\u4e2a\u6807\u51c6\u7684\u8bbe\u8ba1\u4e2d\u5360\u636e\u4e86\u4e00\u5207\uff0c\u5305\u62echeights\uff0cwidths\uff0cpadding\uff0cmargin\uff0cborder\uff0cfont-size\uff0cshadows\uff0c\u51e0\u4e4e\u5305\u62ec\u4f60\u5e03\u5c40\u7684\u6bcf\u90e8\u5206\u3002<\/p>\n \u7b80\u5355\u5730\u8bf4\uff0c\u4e00\u5207\u53ef\u6269\u5c55\u90fd\u5e94\u8be5\u4f7f\u7528 rem \u5355\u4f4d\u3002<\/p>\n \u521b\u5efa\u5e03\u5c40\u65f6\uff0c\u5f80\u5f80\u8981\u4ee5\u50cf\u7d20\u4e3a\u5355\u4f4d\u66f4\u65b9\u4fbf\uff0c\u4f46\u90e8\u7f72\u65f6\u5e94\u4f7f\u7528rem\u5355\u4f4d\u3002<\/p>\n \u4f60\u53ef\u4ee5\u4f7f\u7528\u9884\u5904\u7406\u6bd4\u5982Stylus \/ Sass \/ Less\uff0c\u6765\u81ea\u52a8\u8f6c\u6362\u5355\u4f4d\u6216PostCSS\u4e4b\u7c7b\u7684\u63d2\u4ef6\u3002<\/p>\n \u6216\u8005\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 PXtoEM \u624b\u52a8\u505a\u60a8\u7684\u8f6c\u6362\u3002<\/p>\n \u7279\u522b\u6ce8\u610f\uff0c\u5f53\u4f7f\u7528 rem \u5355\u4f4d\u521b\u5efa\u7edf\u4e00\u53ef\u6269\u5c55\u7684\u8bbe\u8ba1\uff0c\u5a92\u4f53\u67e5\u8be2\u4e5f\u5e94\u8be5\u662frem\u5355\u4f4d\u3002 \u8fd9\u5c06\u786e\u4fdd\uff0c\u65e0\u8bba\u7528\u6237\u6d4f\u89c8\u5668\u7684\u5b57\u4f53\u5927\u5c0f\uff0c\u60a8\u7684\u5a92\u4f53\u67e5\u8be2\u4f1a\u5bf9\u5b83\u4f5c\u51fa\u53cd\u5e94\u548c\u8c03\u6574\u60a8\u7684\u5e03\u5c40\u3002<\/p>\n \u4f8b\u5982\uff0c\u5982\u679c\u7528\u6237\u7f29\u653e\u6587\u672c\u975e\u5e38\u9ad8\uff0c\u60a8\u7684\u5e03\u5c40\u53ef\u80fd\u9700\u8981\u4ece\u4e24\u5217\u5230\u5355\u4e2a\u5217\u8c03\u6574\uff0c\u56e0\u4e3a\u5b83\u53ef\u80fd\u4f1a\u5728\u8f83\u5c0f\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u663e\u793a\u3002<\/p>\n \u5982\u679c\u60a8\u7684\u65ad\u70b9\u5728\u56fa\u5b9a\u7684\u50cf\u7d20\u5bbd\u5ea6\uff0c\u53ea\u6709\u4e0d\u540c\u7684\u89c6\u53e3\u7684\u5927\u5c0f\u53ef\u4ee5\u89e6\u53d1\u5b83\u4eec\u3002 \u4f46\u662f\u57fa\u4e8e rem \u7684\u65ad\u70b9\u4ed6\u4eec\u5c06\u54cd\u5e94\u4e0d\u540c\u7684\u5b57\u4f53\u5927\u5c0f\u3002<\/p>\n \u5e03\u5c40\u4e2d\u7684\u5217\u5bbd\u901a\u5e38\u5e94\u8be5\u662f %\uff0c\u56e0\u6b64\u4ed6\u4eec\u53ef\u4ee5\u6d41\u7545\u9002\u5e94\u65e0\u6cd5\u9884\u77e5\u5927\u5c0f\u7684\u89c6\u533a\u3002<\/p>\n \u7136\u800c\u5355\u4e00\u5217\u4e00\u822c\u4ecd\u7136\u5e94\u4f7f\u7528 rem \u503c\u6765\u8bbe\u7f6e\u6700\u5927\u5bbd\u5ea6\u3002<\/p>\n \u4f8b\u5982:<\/p>\n \u8fd9\u4fdd\u6301\u5217\u7684\u7075\u6d3b\uff0c\u53ef\u6269\u5c55\u3002\u53c8\u80fd\u9632\u6b62\u53d8\u5f97\u592a\u5bbd\u4e86\u3002<\/p>\n \u5728\u4e00\u4e2a\u5178\u578b\u7684 web \u8bbe\u8ba1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4e0d\u4f1a\u6709\u5f88\u591a\u90e8\u5206\u7684\u4f60\u4e0d\u80fd\u4f7f\u7528\u4f38\u7f29\u6027\u8bbe\u8ba1\u7684\u5e03\u5c40\u3002 \u4e0d\u8fc7\u5076\u5c14\u4f60\u4f1a\u9047\u5230\u771f\u7684\u9700\u8981\u4f7f\u7528\u663e\u5f0f\u7684\u56fa\u5b9a\u7684\u503c\uff0c\u4ee5\u9632\u6b62\u7f29\u653e\u7684\u5143\u7d20\u3002<\/p>\n \u91c7\u7528\u56fa\u5b9a\u7684\u5c3a\u5bf8\u503c\u7684\u524d\u63d0\u5e94\u8be5\u662f\uff0c\u5982\u679c\u88ab\u7f29\u653e\u7684\u8bdd\uff0c\u5b83\u7684\u7ed3\u6784\u4f1a\u88ab\u6253\u788e\u3002 \u8fd9\u771f\u7684\u4e0d\u5e38\u51fa\u73b0\uff0c\u6240\u4ee5\u4f60\u60f3\u62ff\u51fa\u90a3\u4e9b px \u5355\u4f4d\u4e4b\u524d\uff0c\u95ee\u95ee\u81ea\u5df1\u662f\u5426\u4f7f\u7528\u5b83\u4eec\u662f\u7edd\u5bf9\u5fc5\u8981\u7684\u3002<\/p>\n \u8ba9\u6211\u4eec\u4ee5\u4e00\u4e2a\u5feb\u901f\u7b26\u53f7\u70b9\u6982\u62ec\u6211\u4eec\u4ecb\u7ecd\u7684\u5185\u5bb9:<\/p>\n \u6211\u5e0c\u671b\u4f60\u73b0\u5728\u5df2\u7ecf\u5efa\u7acb\u4e86\u5f3a\u5065\u7684\u3001 \u5b8c\u6574\u7684\u56fe\u7247\uff0c\u5230\u5e95 em \u548c rem \u7684\u5355\u4f4d\u5982\u4f55\u5de5\u4f5c\uff0c\u5e76\u901a\u8fc7\uff0c\u77e5\u9053\u5982\u4f55\u6700\u597d\u5730\u5229\u7528\u4ed6\u4eec\u5728\u4f60\u7684\u8bbe\u8ba1\u4e2d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u7f16\u8005\uff1a\u5728\u81ea\u9002\u5e94\u5236\u4f5c\u7a3f\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u770b\u5230rem\u548cem\u8fd9\u4e24\u4e2a\u5355\u4f4d\u7684\u5192\u6ce1\uff0crem\u662f\u57fa\u4e8ehtml\u5143\u7d20\u7684\u5b57\u4f53\u5927\u5c0f\u6765\u51b3\u5b9a\uff0c […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[706,705,663],"class_list":["post-2113","post","type-post","status-publish","format-standard","hentry","category-wljs","tag-em","tag-rem","tag-663"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/comments?post=2113"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2113\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
\n\u53e6\u4e00\u65b9\u9762\uff0c\u6d4f\u89c8\u5668\u4f7f\u7528 px \u503c\uff0c\u6240\u4ee5 1px \u5c06\u59cb\u7ec8\u663e\u793a\u4e3a\u5b8c\u5168 1px\u3002<\/p>\n<\/a>\u6700\u5927\u7684\u95ee\u9898\u662f<\/h3>\n
<\/a>\u4e3b\u8981\u533a\u522b<\/h3>\n
<\/a>rem \u5355\u4f4d\u5982\u4f55\u8f6c\u6362\u4e3a\u50cf\u7d20\u503c<\/h2>\n
<\/p>\n
<\/p>\n
<\/a>em \u5355\u4f4d\u5982\u4f55\u8f6c\u6362\u4e3a\u50cf\u7d20\u503c<\/h2>\n
<\/p>\n
<\/p>\n
<\/a>\u91cd\u70b9\u7406\u89e3:<\/h4>\n
<\/a>Em \u5355\u4f4d\u7684\u9057\u4f20\u6548\u679c<\/h2>\n
<\/a>Em \u7ee7\u627f\u7684\u4f8b\u5b50<\/h3>\n
<\/a>\u6d4f\u89c8\u5668\u8bbe\u7f6e HTML<\/span> \u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u7684\u5f71\u54cd<\/h2>\n
<\/p>\n
<\/a>\u4f60\u9700\u8981\u77e5\u9053\u7684:<\/h4>\n
<\/a>\u6ca1\u6709\u8bbe\u7f6e HTML \u5b57\u4f53\u5927\u5c0f\u65f6\uff0c\u6d4f\u89c8\u5668\u8bbe\u7f6e\u8d77\u4f5c\u7528<\/h3>\n
<\/p>\n
<\/p>\n
<\/a>\u6d4f\u89c8\u5668\u5c06\u8c03\u6574\u4f7f\u7528 em \u5355\u4f4d\u7684 HTML \u5143\u7d20\u5b57\u4f53\u5927\u5c0f<\/h3>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/a>\u603b\u7ed3\u4e0e rem \u5dee\u5f02 em<\/h2>\n
\n
<\/a>\u4e3a\u4ec0\u4e48\u4f7f\u7528 rem \u5355\u4f4d:<\/h2>\n
<\/p>\n
<\/p>\n
<\/p>\n
<\/a>\u91cd\u8981\u7684\u662f:<\/h3>\n
<\/a>\u4e3a\u4ec0\u4e48\u4f7f\u7528 em \u5355\u4f4d<\/h2>\n
<\/p>\n
<\/p>\n
<\/a>\u5b9e\u9645\u5e94\u7528<\/h2>\n
<\/a>\u4f7f\u7528 em \u5355\u4f4d:<\/h3>\n
<\/a>\u901a\u5e38\u4e0d\u4f7f\u7528 em \u5355\u4f4d\u63a7\u5236\u5b57\u4f53\u5927\u5c0f<\/h4>\n
<\/a>\u4f7f\u7528 rem \u5355\u4f4d:<\/h3>\n
<\/a>\u5c0f\u8d34\u58eb<\/h4>\n
<\/a>\u59cb\u7ec8\u4f7f\u7528 rem \u5355\u4f4d\u505a\u5a92\u4f53\u67e5\u8be2<\/h4>\n
<\/a>\u4e0d\u8981\u4f7f\u7528 em \u6216 rem :<\/h3>\n
<\/a>\u591a\u5217\u5e03\u5c40<\/h4>\n
\/\/code from http:\/\/caibaojian.com\/rem-vs-em.html\r\n.container {\r\n width: 100%;\r\n max-width: 75rem;\r\n}<\/pre>\n
<\/a>\u5f53\u5143\u7d20\u5e94\u8be5\u662f\u4e25\u683c\u4e0d\u53ef\u7f29\u653e\u7684\u65f6\u5019<\/h4>\n
<\/a>\u603b\u7ed3<\/h2>\n
\n