{"id":28547,"date":"2024-11-25T13:23:52","date_gmt":"2024-11-25T05:23:52","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28547\/"},"modified":"2024-11-25T13:23:52","modified_gmt":"2024-11-25T05:23:52","slug":"%e5%9c%a8%e4%b8%8d%e5%90%8c%e7%9a%84%e7%a7%bb%e5%8a%a8%e8%ae%be%e5%a4%87%e4%b8%8a%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ba%94%e8%af%a5%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%aerpx%e5%8d%95%e4%bd%8d%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28547\/","title":{"rendered":"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f"},"content":{"rendered":"<p><strong>\u6458\u8981<\/strong>: \u6211\u4eec\u5728\u505a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u5728\u5199\u6837\u5f0f\u8868\u7684\u65f6\u5019\u53d1\u73b0\u7528px\u7684\u6548\u679c\u4e0d\u592a\u7406\u60f3\u7684\u60c5\u51b5\u3002\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u5e38\u7528rem\u3001em\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u7684\u50cf\u7d20\u5355\u4f4d\uff0c\u4ed6\u4eec\u90fd\u662f\u76f8\u5bf9\u5355\u4f4d\u3002rem\u76f8\u5bf9\u4e8e\u6587\u6863\u7684\u6839\u5143\u7d20\uff0cem\u76f8\u5bf9\u4e8e\u7236\u5143\u7d20\u3002\u4f46\u662f\u5728 &#8230;<\/p>\n<table>\n<tbody>\n<tr>\n<td>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u6211\u4eec\u5728\u505a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u5728\u5199\u6837\u5f0f\u8868\u7684\u65f6\u5019\u53d1\u73b0\u7528PX\u7684\u6548\u679c\u4e0d\u592a\u7406\u60f3\u7684\u60c5\u51b5\u3002\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u5e38\u7528rem\u3001em\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u7684\u50cf\u7d20\u5355\u4f4d\uff0c\u4ed6\u4eec\u90fd\u662f\u76f8\u5bf9\u5355\u4f4d\u3002rem\u76f8\u5bf9\u4e8e\u6587\u6863\u7684\u6839\u5143\u7d20\uff0cem\u76f8\u5bf9\u4e8e\u7236\u5143\u7d20\u3002\u4f46\u662f\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5b98\u65b9\u6587\u6863\u7528rpx\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u5355\u4f4d\uff01\u90a3\u4ec0\u4e48\u662fRPX,\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6e\u5462\uff1f\u4eca\u5929\u6211\u4eec\u5c31\u6765\u597d\u597d\u4e86\u89e3\u4e00\u4e0b\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/007\/1e1484d931cd86b9a5b5f12b7d5d9a0e-0.png\" class=\"aligncenter\" style=\"max-width:90%\" title=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe\" alt=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe\" \/><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>[color=rgb(44,]<span style=\"font-size:16px\"><span style=\"font-size:16px\"><br \/>rpx\uff08responsive pixel\uff09: \u53ef\u4ee5\u6839\u636e\u5c4f\u5e55\u5bbd\u5ea6\u8fdb\u884c\u81ea\u9002\u5e94\u3002\u89c4\u5b9a\u5c4f\u5e55\u5bbd\u4e3a750rpx\u3002\u5982\u5728 iPhone6 \u4e0a\uff0c\u5c4f\u5e55\u5bbd\u5ea6\u4e3a375px\uff0c\u5171\u6709750\u4e2a\u7269\u7406\u50cf\u7d20\uff0c\u5219750rpx = 375px = 750\u7269\u7406\u50cf\u7d20\uff0c1rpx = 0.5px = 1\u7269\u7406\u50cf\u7d20\u3002 <br \/><\/span><\/span><\/span><\/span><\/p>\n<p style=\"text-align:left\"><span><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/007\/3440fb6423aa3bdc7dc179f967b1e1a8-1.png\" class=\"aligncenter\" style=\"max-width:90%\" title=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe1\" alt=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe1\" \/><\/span><\/p>\n<p style=\"text-align:left\"><span style=\"color:#002000\">\u8bf4\u5b9e\u8bdd\uff0c\u4e00\u5f00\u59cb\u6ca1\u770b\u61c2\u3002<\/span><span><span><span style=\"font-size:16px\">rpx\u5230\u5e95\u662f\u4e2a\u5565\uff1f\u53c8\u8be5\u5982\u4f55\u7406\u89e3\u201c750rpx = 375px = 750\u7269\u7406\u50cf\u7d20\u201d\u8fd9\u53e5\u8bdd\u5462\uff1f<\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u5f00\u59cb\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u626f\u4e00\u626f\u50cf\u7d20\u3001\u7269\u7406\u957f\u5ea6\u3001\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u3001\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u6bd4\u90fd\u662f\u4e9b\u5565\uff1f<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u3010\u50cf\u7d20\u3011\uff1a\u5b83\u4e0d\u662f\u81ea\u7136\u754c\u7684\u7269\u7406\u957f\u5ea6\uff0c\u6307\u57fa\u672c\u539f\u8272\u7d20\u53ca\u5176\u7070\u5ea6\u7684\u57fa\u672c\u7f16\u7801\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u3010\u7269\u7406\u50cf\u7d20\u3011\uff1a\u5b83\u662f\u663e\u793a\u5668\uff08\u7535\u8111\u3001\u624b\u673a\u5c4f\u5e55\uff09\u6700\u5c0f\u7684\u7269\u7406\u663e\u793a\u5355\u4f4d\uff0c\u6bcf\u4e2a\u7269\u7406\u50cf\u7d20\u7531\u989c\u8272\u503c\u548c\u4eae\u5ea6\u503c\u7ec4\u6210\u3002\u662f\u4e0d\u662f\u6709\u70b9\u773c\u719f\uff1f\u6211\u4eec\u8981\u8bb0\u4f4f\u7269\u7406\u50cf\u7d20\u6307\u7684\u662f\u663e\u793a\u5668\u4e0a\u6700\u5c0f\u7684\u70b9\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u3010\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u3011\uff1a\u5b83\u53c8\u79f0\u5bc6\u5ea6\u65e0\u5173\u50cf\u7d20\uff0c\u5212\u91cd\u70b9\u2014\u2014\u5bc6\u5ea6\u65e0\u5173\uff0c\u662f\u8ba1\u7b97\u673a\u7a0b\u5e8f\u5b9e\u9645\u5904\u7406\u7684\u865a\u62df\u50cf\u7d20\uff08\u5982css\u7684px\uff09\uff0c\u7531\u76f8\u5173\u5173\u7cfb\u8f6c\u5316\u4e3a\u8bbe\u5907\u50cf\u7d20\u3002\u8fd9\u4e2a\u76f8\u5173\u5173\u7cfb\u5c31\u662f\u6307\u4e0b\u9762\u8981\u4ecb\u7ecd\u7684\u2014\u2014\u8bbe\u5907\u50cf\u7d20\u6bd4<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u3010\u8bbe\u5907\u50cf\u7d20\u6bd4\u3011\uff1a\u8bbe\u5907\u50cf\u7d20\u6bd4 = \u7269\u7406\u50cf\u7d20 \/ \u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\uff0c\u5355\u4f4d\u662fdpr\uff01<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span style=\"color:#004000\">\u8fd8\u662f\u6ca1\u6709\u770b\u61c2\uff1f\u6ca1\u6709\u5173\u7cfb\uff0c\u6211\u4eec\u4ece\u56fe\u7247\u4e0a\u6765\u770b\u4e00\u4e0b\u79fb\u52a8\u8bbe\u5907\u7684\u5206\u8fa8\u7387\u548crpx\u7684\u5173\u7cfb\uff1a<\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/007\/3440fb6423aa3bdc7dc179f967b1e1a8-2.png\" class=\"aligncenter\" style=\"max-width:90%\" title=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe2\" alt=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe2\" \/><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u4ee5iPhone6\u4e3a\u4f8b\uff1a<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u5df2\u77e5\uff0c1. \u8bbe\u5907\u5bbd\u9ad8 375 * 667\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u770b\u505a\u662fcss\u4e2d\u7684px\uff08\u5bc6\u5ea6\u65e0\u5173\u50cf\u7d20\uff09\uff1b2. retina\u5c4f\u5e55\u7684dpr\u4e3a2\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u6c42 iPhone6 \u7684\u7269\u7406\u50cf\u7d20\u662f\u591a\u5c11\uff1f<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u9001\u5206\u9898\u554a\uff0c\u540c\u5b66\u4eec\uff01<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u6839\u636e\u516c\u5f0f\uff0c\u6211\u4eec\u8ba1\u7b97\u51faiPhone 6 \u7684\u7269\u7406\u50cf\u7d20\u4e3a 750 * 1334<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u7ed3\u8bba\uff1a<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u5728\u4e0d\u540c\u7684\u5c4f\u5e55\u4e0a(\u666e\u901a\u5c4f\u5e55 vs retina\u5c4f\u5e55)\uff0ccss\u50cf\u7d20\u6240\u5448\u73b0\u7684\u5927\u5c0f(\u7269\u7406\u5c3a\u5bf8)\u662f\u4e00\u81f4\u7684\uff0c\u4e0d\u540c\u7684\u662f1\u4e2acss\u50cf\u7d20\u6240\u5bf9\u5e94\u7684\u7269\u7406\u50cf\u7d20\u4e2a\u6570\u662f\u4e0d\u4e00\u81f4\u7684\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u5728\u666e\u901a\u5c4f\u5e55\u4e0b\uff0c1\u4e2acss\u50cf\u7d20 \u5bf9\u5e94 1\u4e2a\u7269\u7406\u50cf\u7d20(1:1)\u3002 \u5728retina \u5c4f\u5e55\u4e0b\uff0c1\u4e2acss\u50cf\u7d20\u5bf9\u5e94 2*2\u4e2a\u7269\u7406\u50cf\u7d20(1:4)\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u3010\u4f4d\u56fe\u50cf\u7d20\u3011\uff1a\u4e00\u4e2a\u4f4d\u56fe\u50cf\u7d20\u662f\u6805\u683c\u56fe\u50cf(\u5982\uff1apng, jpg, gif\u7b49)\u6700\u5c0f\u7684\u6570\u636e\u5355\u5143\u3002\u6bcf\u4e00\u4e2a\u4f4d\u56fe\u50cf\u7d20\u90fd\u5305\u542b\u7740\u4e00\u4e9b\u81ea\u8eab\u7684\u663e\u793a\u4fe1\u606f(\u5982\uff1a\u663e\u793a\u4f4d\u7f6e\uff0c\u989c\u8272\u503c\uff0c\u900f\u660e\u5ea6\u7b49)\u3002\u89c9\u5f97\u590d\u6742\uff1f\u4f60\u53ea\u9700\u8981\u8bb0\u4f4f1px\u8868\u793a\u4e00\u4e2a\u56fe\u7247\u6700\u5c0f\u7684\u70b9\u3002\u4e0d\u4fe1\uff1f\u6211\u4eec\u6765\u7528PS\u653e\u5927\u4e00\u5f20\u56fe\u7247\uff0c\u53ef\u4ee5\u770b\u5230\u56fe\u7247\u88ab\u62c6\u5206\u6210\u65e0\u6570\u4e2a\u70b9\uff0c\u4f46\u65e0\u8bba\u4f60\u5982\u4f55\u653e\u5927\u90a3\u4e9b\u5c0f\u70b9\uff0c\u4ed6\u4eec\u90fd\u4e0d\u80fd\u518d\u6b21\u88ab\u62c6\u5206\u4e86\uff0c\u56e0\u4e3a\u4ed6\u4eec\u5df2\u7ecf\u662f\u50cf\u7d20\u7ea7\u522b\u7684\u70b9\u4e86\uff0c\u5df2\u7ecf\u662f\u6700\u5c0f\u7684\u4e86\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u7406\u8bba\u4e0a\uff0c1\u4e2a\u4f4d\u56fe\u50cf\u7d20\u5bf9\u5e94\u4e8e1\u4e2a\u7269\u7406\u50cf\u7d20\uff0c\u56fe\u7247\u624d\u80fd\u5f97\u5230\u5b8c\u7f8e\u6e05\u6670\u7684\u5c55\u793a\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u6240\u4ee5\uff0c\u5728\u5bbd\u9ad8375 * 667\uff0cdpr\u4e3a2 \u7684 iPhone 6\u4e2d\u5b8c\u7f8e\u663e\u793a200*300(css pixel)img\u6807\u7b7e\uff0c\u56fe\u7247\u7684\u5c3a\u5bf8\u5e94\u8be5\u4e3a\u591a\u5c11\u5462\uff1f\u7b54\u6848\u662f\uff1a400 * 600\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u8fd9\u5c31\u662f\u6211\u4eec\u9488\u5bf9iPhone 6 \u7684\u8bbe\u8ba1\u7a3f\u7684\u5c3a\u5bf8\u57fa\u4e8e 750*1334 \u6765\u8bbe\u8ba1\u7684\u76ee\u7684\u4e86\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u56de\u5230\u6b63\u9898&#8230;&#8230;.rpx\u662f\u5565\uff1f<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u6709\u4e86\u4e0a\u9762\u7684\u505a\u94fa\u57ab\uff0c\u6211\u4eec\u77e5\u9053\u4e86\u5bf9\u4e8eiPhone6 \u6765\u8bf4\uff0c 1rpx = 1\u7269\u7406\u50cf\u7d20\uff0c1rpx = 0.5px;<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>\u5982\u679c\u4e0d\u662fiPhone 6 \u5462\uff1f<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>1rpx = window.innerWidth\/750\u3002<\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span>1px = 1rpx * dpr\u3002<\/span><\/span><\/p>\n<p><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">2.\u6837\u5f0f\u5bfc\u5165 <br \/>\u4f7f\u7528@import\u8bed\u53e5\u53ef\u4ee5\u5bfc\u5165\u5916\u8054\u6837\u5f0f\u8868\uff0c@import\u540e\u8ddf\u9700\u8981\u5bfc\u5165\u7684\u5916\u8054\u6837\u5f0f\u8868\u7684\u76f8\u5bf9\u8def\u5f84\uff0c\u7528;\u8868\u793a\u8bed\u53e5\u7ed3\u675f\u3002<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\"><\/span><\/span><\/span><\/span><\/p>\n<p style=\"padding:15px 0\"><\/p>\n<p style=\"font-size:12px\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">[AppleScript] <em>\u7eaf\u6587\u672c\u67e5\u770b<\/em> <em>\u590d\u5236\u4ee3\u7801<\/em><\/span><\/span><\/span><\/span><\/p>\n<pre>&lt;span style=\"color:rgb(44, 62, 80)\"&gt;&lt;span style=\"background-color:rgb(249, 249, 245)\"&gt;&lt;span style=\"font-family:\"&gt;&lt;span style=\"font-size:16px\"&gt;@import \"common.wxss\";&nbsp;&nbsp;&lt;br&gt;@import \"temp\/loadBottomTemp\/loadBottomTemp.wxss\";&nbsp;&nbsp;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">3.\u5185\u8054\u6837\u5f0f <br \/>\u6846\u67b6\u7ec4\u4ef6\u4e0a\u652f\u6301\u4f7f\u7528 style\u3001class \u5c5e\u6027\u6765\u63a7\u5236\u7ec4\u4ef6\u7684\u6837\u5f0f\u3002 <br \/>(1)style\uff1a\u9759\u6001\u7684\u6837\u5f0f\u7edf\u4e00\u5199\u5230 class \u4e2d\u3002style \u63a5\u6536\u52a8\u6001\u7684\u6837\u5f0f\uff0c\u5728\u8fd0\u884c\u65f6\u4f1a\u8fdb\u884c\u89e3\u6790\uff0c\u8bf7\u5c3d\u91cf\u907f\u514d\u5c06\u9759\u6001\u7684\u6837\u5f0f\u5199\u8fdb style \u4e2d\uff0c\u4ee5\u514d\u5f71\u54cd\u6e32\u67d3\u901f\u5ea6\u3002<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\"><\/span><\/span><\/span><\/span><\/p>\n<p style=\"padding:15px 0\"><\/p>\n<p style=\"font-size:12px\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">[AppleScript] <em>\u7eaf\u6587\u672c\u67e5\u770b<\/em> <em>\u590d\u5236\u4ee3\u7801<\/em><\/span><\/span><\/span><\/span><\/p>\n<pre>&lt;span style=\"color:rgb(44, 62, 80)\"&gt;&lt;span style=\"background-color:rgb(249, 249, 245)\"&gt;&lt;span style=\"font-family:\"&gt;&lt;span style=\"font-size:16px\"&gt;\/\/\u52a8\u6001\u6837\u5f0f&nbsp;&nbsp;&lt;br&gt;&lt;view style=\"color:{{color}};\"&gt;&lt;\/view&gt;&nbsp;&nbsp;&lt;br&gt;style=\"width:{{imageWidth}}rpx;height:{{imageHeight}}rpx\";&nbsp;&nbsp;&lt;br&gt;\/\/\u9759\u6001\u6837\u5f0f&nbsp;&nbsp;&lt;br&gt;style=\"color: #1083E5;font-size: 48rpx;font-weight:bold;\"&nbsp;&nbsp;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">(2)class\uff1a\u7528\u4e8e\u6307\u5b9a\u6837\u5f0f\u89c4\u5219\uff0c\u5176\u5c5e\u6027\u503c\u662f\u6837\u5f0f\u89c4\u5219\u4e2d\u7c7b\u9009\u62e9\u5668\u540d(\u6837\u5f0f\u7c7b\u540d)\u7684\u96c6\u5408\uff0c\u6837\u5f0f\u7c7b\u540d\u4e0d\u9700\u8981\u5e26\u4e0a.\uff0c\u6837\u5f0f\u7c7b\u540d\u4e4b\u95f4\u7528\u7a7a\u683c\u5206\u9694\u3002<\/span><\/span><\/span><\/span><\/p>\n<p style=\"padding:15px 0\"><\/p>\n<pre>&lt;span style=\"color:rgb(44, 62, 80)\"&gt;&lt;span style=\"background-color:rgb(249, 249, 245)\"&gt;&lt;span style=\"font-family:\"&gt;&lt;span style=\"font-size:16px\"&gt;&lt;view class=\"normal_view\"&gt;&lt;\/view&gt;&nbsp;&nbsp;&lt;br&gt;class=\"container-row buydes-center-des-select\"&nbsp;&nbsp;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">4.\u9009\u62e9\u5668 <br \/>\u76ee\u524d\u652f\u6301\u7684\u9009\u62e9\u5668\u6709\uff1a <br \/><\/span><\/span><\/span><\/span><\/p>\n<p style=\"text-align:left\"><span><span style=\"font-family:\"><span><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/007\/5db84824c67418ca43fae46ea0918acc-3.png\" title=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe3\" alt=\"\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\uff1f\u63d2\u56fe3\" \/><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">5.\u5168\u5c40\u6837\u5f0f\u4e0e\u5c40\u90e8\u6837\u5f0f <br \/>\u5b9a\u4e49\u5728 app.wxss \u4e2d\u7684\u6837\u5f0f\u4e3a\u5168\u5c40\u6837\u5f0f\uff0c\u4f5c\u7528\u4e8e\u6bcf\u4e00\u4e2a\u9875\u9762\u3002\u5728 page \u7684 wxss \u6587\u4ef6\u4e2d\u5b9a\u4e49\u7684\u6837\u5f0f\u4e3a\u5c40\u90e8\u6837\u5f0f\uff0c\u53ea\u4f5c\u7528\u5728\u5bf9\u5e94\u7684\u9875\u9762\uff0c\u5e76\u4f1a\u8986\u76d6 app.wxss \u4e2d\u76f8\u540c\u7684\u9009\u62e9\u5668\u3002<\/span><\/span><\/span><\/span><\/p>\n<p><strong>\u4e8c\uff1a\u8bbe\u5907\u7269\u7406\u50cf\u7d20(\u8bbe\u5907\u50cf\u7d20) \u8bbe\u5907\u903b\u8f91\u50cf\u7d20(\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20) \u4ee3\u7801CSS\u50cf\u7d20 \u8bbe\u5907\u50cf\u7d20\u6bd4 viewport\u6df1\u5165\u7406\u89e3<\/strong><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">1.viewport(\u53ef\u89c6\u533a\u57df\u5927\u5c0f)\u7684\u6982\u5ff5\u7406\u89e3\u548c\u77e5\u8bc6\u79ef\u7d2f <br \/>(1)\u79fb\u52a8\u8bbe\u5907\u4e0a\u7684viewport\u5c31\u662f\u8bbe\u5907\u7684\u5c4f\u5e55\u4e0a\u80fd\u7528\u6765\u663e\u793a\u7f51\u9875\u7684\u90a3\u4e00\u5757\u533a\u57df,\u5c31\u662f\u6d4f\u89c8\u5668\u4e0a\u7528\u6765\u663e\u793a\u7f51\u9875\u7684\u90a3\u90e8\u5206\u533a\u57df <br \/>(2)viewport\u4e0d\u4e00\u5b9a\u662f\u6d4f\u89c8\u5668\u6216\u8005\u8bbe\u5907\u5c4f\u5e55\u53ef\u89c6\u533a\u57df\u7684\u5927\u5c0f,\u53ef\u80fd\u6bd4\u53ef\u89c6\u533a\u57df\u5927,\u4e5f\u53ef\u80fd\u6bd4\u53ef\u89c6\u533a\u57df\u5c0f,\u56e0\u4e3aviewport\u7684\u5927\u5c0f\u662f\u53ef\u4ee5\u8bbe\u7f6e\u7684 <br \/>(3)\u5927\u90e8\u5206\u79fb\u52a8\u8bbe\u5907\u9ed8\u8ba4\u7684viewport\u90fd\u662f980px,\u591a\u6570\u60c5\u51b5\u4e0b\u8981\u5927\u4e8edevice-width,\u56e0\u6b64\u4e00\u822c\u90fd\u8981\u5728\u79fb\u52a8\u7aef\u91cd\u7f6eviewport,\u8ba9width=device-width <br \/>(4)\u901a\u8fc7JavaScript\u83b7\u53d6viewport\u7684\u65b9\u5f0f\uff1adocument.documentElement.clientWidth,\u83b7\u53d6device-width\u7684\u65b9\u5f0fwindow.innerWidth,\u83b7\u53d6\u8bbe\u5907\u50cf\u7d20\u6bd4window.devicePixelRatio <br \/>(5)\u82f9\u679c\u4eceiPhone4\u5f00\u59cb\u5f15\u8fdb\u4e86Retina\u5c4f\u5e55,\u4e00\u4e2aCSS\u50cf\u7d20\u53ef\u4ee5\u8868\u793a\u591a\u4e2a\u7269\u7406\u50cf\u7d20,\u5e76\u4e14\u5728\u9875\u9762\u7f29\u653e\u5230\u5176\u4ed6\u6bd4\u4f8b\u65f6\u5019,\u4e5f\u53ef\u4ee5\u505a\u5230CSS \u76841px\u8868\u793a\u591a\u4e2adevice pixels <br \/>(6)\u524d\u7aef\u5f00\u53d1\u4e2d\u7684CSS pixels\u548c\u8bbe\u5907\u5206\u8fa8\u7387\u6240\u8bb2\u7684resolution pixels \u65e0\u5173,\u5f00\u53d1\u4e2d\u7684CSS pixels\u548c\u8bbe\u5907\u50cf\u7d20\u6bd4\u6709\u5173 <br \/><\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">2.\u79fb\u52a8\u7aef\u7684HTML5\u5f00\u53d1META\u7684\u5e38\u7528\u8bbe\u7f6e<\/span><\/span><\/span><\/span><\/p>\n<p style=\"padding:15px 0\"><\/p>\n<pre>&lt;span style=\"color:rgb(44, 62, 80)\"&gt;&lt;span style=\"background-color:rgb(249, 249, 245)\"&gt;&lt;span style=\"font-family:\"&gt;&lt;span style=\"font-size:16px\"&gt;&lt;meta content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\" name=\"viewport\"&gt;&nbsp;&nbsp;&lt;br&gt;&lt;meta content=\"yes\" name=\"apple-mobile-web-app-capable\"&gt;&nbsp;&nbsp;&lt;br&gt;&lt;meta content=\"black\" name=\"apple-mobile-web-app-status-bar-style\"&gt;&nbsp;&nbsp;&lt;br&gt;&lt;meta content=\"telephone=no\" name=\"format-detection\"&gt;&nbsp;&nbsp;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;&lt;\/span&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">\u7b2c\u4e00\u4e2ameta\u6807\u7b7e\u8868\u793a\uff1a\u5f3a\u5236\u8ba9\u6587\u6863\u7684\u5bbd\u5ea6(viewport\u5bbd\u5ea6)\u4e0e\u8bbe\u5907\u7684\u5bbd\u5ea6\u4fdd\u63011:1,\u5e76\u4e14\u6587\u6863\u6700\u5927\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u662f1.0,\u4e14\u4e0d\u5141\u8bb8\u7528\u6237\u70b9\u51fb\u5c4f\u5e55\u653e\u5927\u6d4f\u89c8\uff1b <br \/>width &#8211; viewport\u7684\u5bbd\u5ea6 height &#8211; viewport\u7684\u9ad8\u5ea6 [device-width(\u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20\u5bbd) | pixel_value] pixel_value\u662f\u5177\u4f53\u7684\u50cf\u7d20\u503c <br \/>\u6848\u4f8b:<\/span><\/span><\/span><\/span><\/p>\n<p style=\"padding:15px 0\"><\/p>\n<pre>&nbsp;&lt;meta&gt;<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">initial-scale &#8211; \u521d\u59cb\u7684\u7f29\u653e\u6bd4\u4f8b <br \/>minimum-scale &#8211; \u5141\u8bb8\u7528\u6237\u7f29\u653e\u5230\u7684\u6700\u5c0f\u6bd4\u4f8b <br \/>maximum-scale &#8211; \u5141\u8bb8\u7528\u6237\u7f29\u653e\u5230\u7684\u6700\u5927\u6bd4\u4f8b <br \/>user-scalable &#8211; \u7528\u6237\u662f\u5426\u53ef\u4ee5\u624b\u52a8\u7f29\u653e,\u8fd9\u91cc\u6709\u7684\u8d44\u6599\u5199\u6210no\u6709\u7684\u5199\u62100 <br \/>\u7b2c\u4e8c\u4e2ameta\u6807\u7b7e\u662fiphone\u8bbe\u5907\u4e2d\u7684safari\u79c1\u6709meta\u6807\u7b7e,\u5b83\u8868\u793a\uff1a\u5141\u8bb8\u5168\u5c4f\u6a21\u5f0f\u6d4f\u89c8\uff1b <br \/>\u7b2c\u4e09\u4e2ameta\u6807\u7b7e\u4e5f\u662fiphone\u7684\u79c1\u6709\u6807\u7b7e,\u5b83\u6307\u5b9a\u7684iphone\u4e2dsafari\u9876\u7aef\u7684\u72b6\u6001\u6761\u7684\u6837\u5f0f\uff1b <br \/>\u5728web app\u5e94\u7528\u4e0b\u72b6\u6001\u6761\uff08\u5c4f\u5e55\u9876\u90e8\u6761\uff09\u7684\u989c\u8272\uff1b <br \/>\u9ed8\u8ba4\u503c\u4e3adefault\uff08\u767d\u8272\uff09,\u53ef\u4ee5\u5b9a\u4e3ablack\uff08\u9ed1\u8272\uff09\u548cblack-translucent\uff08\u7070\u8272\u534a\u900f\u660e\uff09\u3002 <br \/>\u6ce8\u610f\uff1a\u82e5\u503c\u4e3a\u201cblack-translucent\u201d\u5c06\u4f1a\u5360\u636e\u9875\u9762px\u4f4d\u7f6e,\u6d6e\u5728\u9875\u9762\u4e0a\u65b9\uff08\u4f1a\u8986\u76d6\u9875\u976220px\u9ad8\u5ea6\u2013iphone4\u548citouch4\u7684Retina\u5c4f\u5e55\u4e3a40px\uff09\u3002 <br \/>\u7b2c\u56db\u4e2ameta\u6807\u7b7e\u8868\u793a\uff1a\u544a\u8bc9\u8bbe\u5907\u5ffd\u7565\u5c06\u9875\u9762\u4e2d\u7684\u6570\u5b57\u8bc6\u522b\u4e3a\u7535\u8bdd\u53f7\u7801\u3002<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">HTML5 META\u6807\u7b7e\u5e38\u7528\u8bbe\u7f6e\u53c2\u8003\u8d44\u6599\u70b9\u51fb\u6253\u5f00\u94fe\u63a5\u70b9\u51fb\u6253\u5f00\u94fe\u63a5 \u70b9\u51fb\u6253\u5f00\u94fe\u63a5<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">3.\u8bbe\u5907\u7269\u7406\u50cf\u7d20(\u8bbe\u5907\u50cf\u7d20),\u8bbe\u5907\u903b\u8f91\u50cf\u7d20(\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20),\u4ee3\u7801CSS\u50cf\u7d20,\u8bbe\u5907\u50cf\u7d20\u6bd4 <br \/>\u8bbe\u5907\u7269\u7406\u5206\u8fa8\u7387(device pixels):\u7269\u7406\u5206\u8fa8\u7387\u4e5f\u53eb\u8bbe\u5907\u50cf\u7d20,\u7269\u7406\u5206\u8fa8\u7387\u662fLED\u663e\u793a\u5c4f\u663e\u793a\u7684\u56fe\u50cf\u539f\u59cb\u5206\u8fa8\u7387<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">\u8bbe\u5907\u903b\u8f91\u5206\u8fa8\u7387(device independent pixels):\u4eba\u5bf9\u4e8e\u7269\u4f53\u771f\u5b9e\u5c3a\u5bf8\u7684\u8ba4\u77e5(\u5c4f\u5e55\u5927\u5c0f),\u8bbe\u8ba1\u4f7f\u7528\u903b\u8f91\u50cf\u7d20\u6765\u601d\u8003\u754c\u9762<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">\u4ee3\u7801CSS\u50cf\u7d20:CSS\u50cf\u7d20\u662fWeb\u7f16\u7a0b\u7684\u6982\u5ff5,\u72ec\u7acb\u4e8e\u8bbe\u5907\u7684\u7528\u4e8e\u903b\u8f91\u4e0a\u8861\u91cf\u50cf\u7d20\u7684\u5355\u4f4d,\u4e5f\u5c31\u662f\u8bf4\u6211\u4eec\u5728\u505a\u7f51\u9875\u65f6\u7528\u5230\u7684CSS\u50cf\u7d20\u5355\u4f4d\u662f\u62bd\u8c61\u7684,\u800c\u4e0d\u662f\u5b9e\u9645\u5b58\u5728\u7684<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">iphone 6\u4e3a\u4f8b(\u8bbe\u5907\u50cf\u7d20\u6bd4\u662f2): <br \/>\u8bbe\u5907\u7269\u7406\u50cf\u7d20(\u8bbe\u5907\u50cf\u7d20):750&#215;1334 <br \/>\u8bbe\u5907\u903b\u8f91\u50cf\u7d20(\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20):375&#215;667 <br \/>\u4ee3\u7801CSS\u50cf\u7d20:375&#215;667 <br \/>device-width(\u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20\u5bbd):375 (1 CSS PX = 2 \u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20)<\/span><\/span><\/span><\/span><\/p>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">**\u6848\u4f8b\uff1a**iphone 6s \u7684\u7269\u7406\u50cf\u7d20\u662f750&#215;1334,JS\u4e2dwindow.innerWidth\u5c31\u662f\u83b7\u53d6\u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20,\u4e3a\u4ec0\u4e48window.innerWidth\u83b7\u53d6\u7684\u503c\u662f375\u800c\u4e0d\u662f750\u5462? <br \/>\u56e0\u4e3awindow.innerWidth\u7684\u503c\u662f\u7528CSS pixels\u6765\u8868\u793a\u7684,\u800ciphone 6s\u7684\u8bbe\u5907\u50cf\u7d20\u6bd4\u662f2,1 CSS PX = 2 \u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20,\u6240\u4ee5window.innerWidth\u83b7\u53d6\u7684\u503c\u662f375px,\u800c\u4e0d\u662f750px(750px = 375px * \u8bbe\u5907\u50cf\u7d20\u6bd4)<\/span><\/span><\/span><\/span><\/p>\n<blockquote><p>\n      \u57281\u500d\u7387\u7684\u5c4f\u5e55\u4e0a: 1 CSS PX = 1 \u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20 \u57282\u500d\u7387\u7684\u5c4f\u5e55\u4e0a: 1 CSS PX = 2 \u8bbe\u5907\u7684\u7269\u7406\u50cf\u7d20 \u8bbe\u5907\u50cf\u7d20\u6bd4=\u8bbe\u5907\u50cf\u7d20\/\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20(\u7269\u7406\u50cf\u7d20\/\u903b\u8f91\u50cf\u7d20) \u56fe\u7247\u5b9e\u9645\u50cf\u7d20 = \u56fe\u7247\u903b\u8f91\u50cf\u7d20\/\u8bbe\u5907\u50cf\u7d20\u6bd41\u500d\uff1a1pt=1dp=1px\uff08mdpi\u3001iPhone&nbsp;3gs\uff09&nbsp;&nbsp; 2\u500d\uff1a1pt=1dp=2px\uff08xhdpi\u3001iPhone&nbsp;4s\/5\/6\uff09&nbsp;&nbsp; 3\u500d\uff1a1pt=1dp=3px\uff08xxhdpi\u3001iPhone&nbsp;6&nbsp;plus\uff09\n    <\/p><\/blockquote>\n<p style=\"line-height:27px;text-indent:nullem;text-align:left\"><span><span><span style=\"font-family:\"><span style=\"font-size:16px\">\u4ee5iPhone 5s\u4e3a\u4f8b,\u5c4f\u5e55\u7684\u5206\u8fa8\u7387\u662f640\u00d71136,\u500d\u7387\u662f2\u3002\u6d4f\u89c8\u5668\u4f1a\u8ba4\u4e3a\u5c4f\u5e55\u7684\u5206\u8fa8\u7387\u662f320\u00d7568,\u4ecd\u7136\u662f\u57fa\u51c6\u500d\u7387\u7684\u5c3a\u5bf8\u3002 <br \/>\u6240\u4ee5\u5728\u5236\u4f5c\u9875\u9762\u65f6,\u53ea\u9700\u8981\u6309\u7167\u57fa\u51c6\u500d\u7387\u6765\u5c31\u884c\u4e86\u3002\u65e0\u8bba\u4ec0\u4e48\u6837\u7684\u5c4f\u5e55,\u500d\u7387\u662f\u591a\u5c11,\u90fd\u6309\u903b\u8f91\u50cf\u7d20\u5c3a\u5bf8\u6765\u8bbe\u8ba1\u548c\u5f00\u53d1\u9875\u9762\u3002 <br \/>\u53ea\u4e0d\u8fc7\u5728\u51c6\u5907\u8d44\u6e90\u56fe\u7684\u65f6\u5019,\u9700\u8981\u51c6\u59072\u500d\u5927\u5c0f\u7684\u56fe,\u901a\u8fc7\u4ee3\u7801\u628a\u5b83\u7f29\u62101\u500d\u5927\u5c0f\u663e\u793a,\u624d\u80fd\u4fdd\u8bc1\u6e05\u6670\u3002<\/span><\/span><\/span><\/span><\/p>\n<p> <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5728\u4e0d\u540c\u7684\u79fb\u52a8\u8bbe\u5907\u4e0a\u5c0f\u7a0b\u5e8f\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6erpx\u5355\u4f4d\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>\u6458\u8981: \u6211\u4eec\u5728\u505a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u5728\u5199\u6837\u5f0f\u8868\u7684\u65f6\u5019\u53d1\u73b0\u7528px\u7684\u6548\u679c\u4e0d\u592a\u7406\u60f3\u7684\u60c5\u51b5\u3002\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u5e38\u7528rem\u3001em\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u7684\u50cf\u7d20\u5355\u4f4d\uff0c\u4ed6\u4eec\u90fd\u662f\u76f8\u5bf9\u5355\u4f4d\u3002rem\u76f8\u5bf9\u4e8e\u6587\u6863\u7684\u6839\u5143\u7d20\uff0cem\u76f8\u5bf9\u4e8e\u7236\u5143\u7d20\u3002\u4f46\u662f\u5728 &#8230; \u6211\u4eec\u5728\u505a\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5f00\u53d1\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u5728\u5199\u6837\u5f0f\u8868\u7684\u65f6\u5019\u53d1\u73b0\u7528PX\u7684\u6548\u679c\u4e0d\u592a\u7406\u60f3\u7684\u60c5\u51b5\u3002\u65e5\u5e38\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u5e38\u7528rem\u3001em\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u7684\u50cf\u7d20\u5355\u4f4d\uff0c\u4ed6\u4eec\u90fd\u662f\u76f8\u5bf9\u5355\u4f4d\u3002rem\u76f8\u5bf9\u4e8e\u6587\u6863\u7684\u6839\u5143\u7d20\uff0cem\u76f8\u5bf9\u4e8e\u7236\u5143\u7d20\u3002\u4f46\u662f\u5728\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u7684\u5b98\u65b9\u6587\u6863\u7528rpx\u6765\u505a\u54cd\u5e94\u5f0f\u5e03\u5c40\u5355\u4f4d\uff01\u90a3\u4ec0\u4e48\u662fRPX,\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6e\u5462\uff1f\u4eca\u5929\u6211\u4eec\u5c31\u6765\u597d\u597d\u4e86\u89e3\u4e00\u4e0b\u3002 [color=rgb(44,]rpx\uff08responsive pixel\uff09: \u53ef\u4ee5\u6839\u636e\u5c4f\u5e55\u5bbd\u5ea6\u8fdb\u884c\u81ea\u9002\u5e94\u3002\u89c4\u5b9a\u5c4f\u5e55\u5bbd\u4e3a750rpx\u3002\u5982\u5728 iPhone6 \u4e0a\uff0c\u5c4f\u5e55\u5bbd\u5ea6\u4e3a375px\uff0c\u5171\u6709750\u4e2a\u7269\u7406\u50cf\u7d20\uff0c\u5219750rpx = 375px = 750\u7269\u7406\u50cf\u7d20\uff0c1rpx = 0.5px = 1\u7269\u7406\u50cf\u7d20\u3002 \u8bf4\u5b9e\u8bdd\uff0c\u4e00\u5f00\u59cb\u6ca1\u770b\u61c2\u3002rpx\u5230\u5e95\u662f\u4e2a\u5565\uff1f\u53c8\u8be5\u5982\u4f55\u7406\u89e3\u201c750rpx = 375px = 750\u7269\u7406\u50cf\u7d20\u201d\u8fd9\u53e5\u8bdd\u5462\uff1f \u5f00\u59cb\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u626f\u4e00\u626f\u50cf\u7d20\u3001\u7269\u7406\u957f\u5ea6\u3001\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u3001\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u6bd4\u90fd\u662f\u4e9b\u5565\uff1f \u3010\u50cf\u7d20\u3011\uff1a\u5b83\u4e0d\u662f\u81ea\u7136\u754c\u7684\u7269\u7406\u957f\u5ea6\uff0c\u6307\u57fa\u672c\u539f\u8272\u7d20\u53ca\u5176\u7070\u5ea6\u7684\u57fa\u672c\u7f16\u7801\u3002 \u3010\u7269\u7406\u50cf\u7d20\u3011\uff1a\u5b83\u662f\u663e\u793a\u5668\uff08\u7535\u8111\u3001\u624b\u673a\u5c4f\u5e55\uff09\u6700\u5c0f\u7684\u7269\u7406\u663e\u793a\u5355\u4f4d\uff0c\u6bcf\u4e2a\u7269\u7406\u50cf\u7d20\u7531\u989c\u8272\u503c\u548c\u4eae\u5ea6\u503c\u7ec4\u6210\u3002\u662f\u4e0d\u662f\u6709\u70b9\u773c\u719f\uff1f\u6211\u4eec\u8981\u8bb0\u4f4f\u7269\u7406\u50cf\u7d20\u6307\u7684\u662f\u663e\u793a\u5668\u4e0a\u6700\u5c0f\u7684\u70b9\u3002 \u3010\u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\u3011\uff1a\u5b83\u53c8\u79f0\u5bc6\u5ea6\u65e0\u5173\u50cf\u7d20\uff0c\u5212\u91cd\u70b9\u2014\u2014\u5bc6\u5ea6\u65e0\u5173\uff0c\u662f\u8ba1\u7b97\u673a\u7a0b\u5e8f\u5b9e\u9645\u5904\u7406\u7684\u865a\u62df\u50cf\u7d20\uff08\u5982css\u7684px\uff09\uff0c\u7531\u76f8\u5173\u5173\u7cfb\u8f6c\u5316\u4e3a\u8bbe\u5907\u50cf\u7d20\u3002\u8fd9\u4e2a\u76f8\u5173\u5173\u7cfb\u5c31\u662f\u6307\u4e0b\u9762\u8981\u4ecb\u7ecd\u7684\u2014\u2014\u8bbe\u5907\u50cf\u7d20\u6bd4 \u3010\u8bbe\u5907\u50cf\u7d20\u6bd4\u3011\uff1a\u8bbe\u5907\u50cf\u7d20\u6bd4 = \u7269\u7406\u50cf\u7d20 \/ \u8bbe\u5907\u72ec\u7acb\u50cf\u7d20\uff0c\u5355\u4f4d\u662fdpr\uff01 \u8fd8\u662f\u6ca1\u6709\u770b\u61c2\uff1f\u6ca1\u6709\u5173\u7cfb\uff0c\u6211\u4eec\u4ece\u56fe\u7247\u4e0a\u6765\u770b\u4e00\u4e0b\u79fb\u52a8\u8bbe\u5907\u7684\u5206\u8fa8\u7387\u548crpx\u7684\u5173\u7cfb\uff1a \u4ee5iPhone6\u4e3a\u4f8b\uff1a \u5df2\u77e5\uff0c1. \u8bbe\u5907\u5bbd\u9ad8 375 * 667\uff0c\u5728\u8fd9\u91cc\u6211\u4eec\u53ef\u4ee5\u770b\u505a\u662fcss\u4e2d\u7684px\uff08\u5bc6\u5ea6\u65e0\u5173\u50cf\u7d20\uff09\uff1b2. retina\u5c4f\u5e55\u7684dpr\u4e3a2\u3002 \u6c42 iPhone6 \u7684\u7269\u7406\u50cf\u7d20\u662f\u591a\u5c11\uff1f \u9001\u5206\u9898\u554a\uff0c\u540c\u5b66\u4eec\uff01 \u6839\u636e\u516c\u5f0f\uff0c\u6211\u4eec\u8ba1\u7b97\u51faiPhone 6 \u7684\u7269\u7406\u50cf\u7d20\u4e3a 750 * 1334 \u7ed3\u8bba\uff1a \u5728\u4e0d\u540c\u7684\u5c4f\u5e55\u4e0a(\u666e\u901a\u5c4f\u5e55 vs retina\u5c4f\u5e55)\uff0ccss\u50cf\u7d20\u6240\u5448\u73b0\u7684\u5927\u5c0f(\u7269\u7406\u5c3a\u5bf8)\u662f\u4e00\u81f4\u7684\uff0c\u4e0d\u540c\u7684\u662f1\u4e2acss\u50cf\u7d20\u6240\u5bf9\u5e94\u7684\u7269\u7406\u50cf\u7d20\u4e2a\u6570\u662f\u4e0d\u4e00\u81f4\u7684\u3002 \u5728\u666e\u901a\u5c4f\u5e55\u4e0b\uff0c1\u4e2acss\u50cf\u7d20 \u5bf9\u5e94 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-28547","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28547","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=28547"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28547\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}