{"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

\"\u539f\u6587\u6765\u81eahttp:\/\/caibaojian.com\/rem-vs-em.html\"<\/p>\n

CSS<\/a><\/span> \u8fb9\u8ddd\u8bbe\u7f6e\u4e3a 1em<\/p>\n

\"570843-b0784ff313ceade4\"<\/p>\n

\u6d4f\u89c8\u5668\u7ffb\u8bd1\u621016px<\/p>\n

\"570843-87102d8dbfe975b0\"<\/p>\n

CSS padding\u8bbe\u4e3a 16px<\/p>\n

\"570843-ac9752d0dd89ae87\"<\/p>\n

\u6d4f\u89c8\u5668\u7ffb\u8bd1\u6210160px
\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

\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

<\/a>\u6700\u5927\u7684\u95ee\u9898\u662f<\/h3>\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

<\/a>\u4e3b\u8981\u533a\u522b<\/h3>\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

<\/a>rem \u5355\u4f4d\u5982\u4f55\u8f6c\u6362\u4e3a\u50cf\u7d20\u503c<\/h2>\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

\"570843-82d2d7429b664e69\"<\/p>\n

CSS padding\u8bbe\u7f6e\u4e3a 10rem<\/p>\n

\"570843-7db706f7b5cbb432\"<\/p>\n

\u8ba1\u7b97\u7ed3\u679c\u4e3a160px<\/p>\n

<\/a>em \u5355\u4f4d\u5982\u4f55\u8f6c\u6362\u4e3a\u50cf\u7d20\u503c<\/h2>\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

\"570843-45fdc569069298bb\"<\/p>\n

CSS padding\u8bbe\u7f6e\u4e3a 10em<\/p>\n

\"570843-861e1122040b148a\"<\/p>\n

\u8ba1\u7b97\u5230 180px (\u6216\u63a5\u8fd1\u5b83)<\/p>\n

<\/a>\u91cd\u70b9\u7406\u89e3:<\/h4>\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

<\/a>Em \u5355\u4f4d\u7684\u9057\u4f20\u6548\u679c<\/h2>\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

<\/a>Em \u7ee7\u627f\u7684\u4f8b\u5b50<\/h3>\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

<\/a>\u6d4f\u89c8\u5668\u8bbe\u7f6e HTML<\/span> \u5143\u7d20\u5b57\u4f53\u5927\u5c0f\u7684\u5f71\u54cd<\/h2>\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

\"570843-68f104cb4935dab4\"<\/p>\n

<\/a>\u4f60\u9700\u8981\u77e5\u9053\u7684:<\/h4>\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

<\/a>\u6ca1\u6709\u8bbe\u7f6e HTML \u5b57\u4f53\u5927\u5c0f\u65f6\uff0c\u6d4f\u89c8\u5668\u8bbe\u7f6e\u8d77\u4f5c\u7528<\/h3>\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

\"570843-327d7a8b383cefd4\"<\/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

\"570843-179783413d0ed4bd\"<\/p>\n

<\/a>\u6d4f\u89c8\u5668\u5c06\u8c03\u6574\u4f7f\u7528 em \u5355\u4f4d\u7684 HTML \u5143\u7d20\u5b57\u4f53\u5927\u5c0f<\/h3>\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

\"570843-10d636623e943a86\"<\/p>\n

\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b 10rem \u5c06\u7b49\u4e8e 200px\uff0c\u5373 10 \u00d7 20 = 200\u3002<\/p>\n

\"570843-45689dcf59f2f788\"<\/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

\"570843-1e2854eef74df2a6\"<\/p>\n

\u73b0\u5728 10rem \u5c06\u7b49\u4e8e 250px\uff0c\u5373 10 \u00d7 25 = 250\u3002<\/p>\n

\"570843-bd24d712c8191dd2\"<\/p>\n

<\/a>\u603b\u7ed3\u4e0e rem \u5dee\u5f02 em<\/h2>\n

\u4e0a\u8ff0\u6240\u6709\u5f52\u7ed3\u5982\u4e0b:<\/p>\n