{"id":675,"date":"2017-03-03T15:11:36","date_gmt":"2017-03-03T07:11:36","guid":{"rendered":"http:\/\/www.qdabc.cn\/?p=675"},"modified":"2017-03-03T15:11:36","modified_gmt":"2017-03-03T07:11:36","slug":"%e7%a7%bb%e5%8a%a8%e7%ab%af%e9%a1%b5%e9%9d%a2%e9%87%8d%e6%9e%84%e5%b8%83%e5%b1%80%ef%bc%88layout%ef%bc%89","status":"publish","type":"post","link":"http:\/\/www.qdabc.cn\/?p=675","title":{"rendered":"\u79fb\u52a8\u7aef\u9875\u9762\u91cd\u6784\u5e03\u5c40\uff08layout\uff09"},"content":{"rendered":"<p>\u4e0b\u9762\u6211\u5c06\u7b80\u5355\u7684\u4ecb\u7ecd\u79fb\u52a8\u7aef\u5e03\u5c40\u7684\u516b\u79cd\u65b9\u5f0f\uff1a<br \/>\n<b>1.\u56fa\u5b9a\u5e03\u5c40<\/b><br \/>\n<b>2.\u6d41\u52a8\u5e03\u5c40<\/b><br \/>\n<b>3.\u6d6e\u52a8\u5e03\u5c40<\/b><br \/>\n<b>4.\u5b9a\u4f4d\u5e03\u5c40<\/b><br \/>\n<b>5.\u6df7\u5408\u5e03\u5c40<\/b><br \/>\n<b>6.flex\u5e03\u5c40<\/b><br \/>\n<b>7.rem\u5e03\u5c40<\/b><br \/>\n<b>8.\u54cd\u5e94\u5f0f\u5e03\u5c40<\/b><\/p>\n<p><b>1.\u56fa\u5b9a\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n&lt;head&gt;\u91cc\u628a&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0&#8243;&gt;\u52a0\u597d\uff0c\u7136\u540e\u6839\u636e\u8bbe\u8ba1\u7a3f\u8bbe\u5b9a\u76f8\u5e94\u7684\u5bbd\u5ea6\u5373\u53ef\uff0c\u5176\u4ed6\u5730\u65b9\u7c7b\u4f3c\u4e8epc\u7aef\u3002<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u601d\u8def\u6cbf\u7528pc\u7aef\uff0c\u4e0a\u624b\u6bd4\u8f83\u5feb<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u5927\u5c4f\u624b\u673a\u663e\u793a\u7f51\u9875\u6bd4\u8f83\u5bbd\uff0c\u800c\u56fa\u5b9a\u5e03\u5c40\u5bbd\u5ea6\u53c2\u7167\u6c38\u8fdc\u662f\u56fa\u5b9a\u7684\u5bbd\u5ea6\uff08\u8bbe\u8ba1\u7a3f\u7684\u5927\u5c0f\uff09\uff0c\u5bfc\u81f4\u5de6\u53f3\u4e24\u8fb9\u4f1a\u6709\u7a7a\u767d\u3002\u624b\u673a\u6a2a\u5c4f\u7684\u65f6\u5019\u4e24\u8fb9\u7a7a\u767d\u66f4\u4eae\u3002<br \/>\n<b>2.\u6d41\u52a8\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n\u9002\u7528\u767e\u5206\u6bd4\u505a\u5355\u4f4d\u3002<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u80fd\u66f4\u5f88\u597d\u7684\u9002\u5e94\u5404\u4e2a\u5c4f\u5e55\u5206\u8fa8\u7387\u7684\u624b\u673a\u3002<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u4e0d\u591f\u7075\u6d3b\uff0c\u6dfb\u52a0\u5143\u7d20\u65f6\uff0c\u9700\u8981\u66f4\u6539\u5176\u4ed6\u5143\u7d20\u7684\u503c\u3002<br \/>\n<b>3.\u6d6e\u52a8\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\nfloat+clearfix(\u6e05\u9664\u6d6e\u52a8)<\/p>\n<pre class=\"brush:js;toolbar:false\">\/*--\u4e0d\u9700\u517c\u5bb9\u8001\u7248\u672c--*\/\r\n.clearfix:after{\r\n    content:\"\";\r\n    display:block;\r\n    clear:both;\r\n}\r\n\/*--\u9700\u8981\u517c\u5bb9\u8001\u7248\u672c--*\/\r\n.clearfix:after{\r\n    content:\"\";\r\n    display:block;\r\n    clear:both;\r\n    height:0;\r\n    visibility:hidden;\r\n}<\/pre>\n<p><b>\u4f18\u70b9<\/b><br \/>\n\u8fd9\u662f\u4f20\u7edf\u7684\u6d6e\u52a8\u65b9\u5f0f\uff0c\u5199\u6cd5\u7b80\u5355\uff0c\u5b9e\u73b0\u6548\u679c\u8d77\u6765\u5e72\u8106\u5229\u843d<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u5bf9\u6d6e\u52a8\u5143\u7d20\u8981\u6c42\u6bd4\u8f83\u4e25\u683c\uff0c\u5e03\u5c40\u4e5f\u4e0d\u592a\u7075\u6d3b<br \/>\n<b>4.\u5b9a\u4f4d\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n\u5728\u5e03\u5c40\u5f53\u4e2d\u5f88\u5e38\u7528\uff0c\u5229\u7528position+\u56db\u4e2a\u65b9\u4f4d\u7684\u5177\u4f53\u503c\uff08top\/left\/right\/bottom\uff09\u76f8\u4e92\u914d\u5408\uff0c\u5b9e\u73b0\u8d77\u6765\u4e5f\u6bd4\u8f83\u5bb9\u6613<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u5b9e\u73b0\u7b80\u5355\uff0c\u5728\u79fb\u52a8\u7aef\u4e2d\uff0c\u5b9a\u4f4d\u5f88\u5e38\u7528\uff0c\u5c24\u5176\u662f\u5f39\u7a97\uff0c<\/p>\n<pre class=\"brush:js;toolbar:false\">.mask{\r\n    position:fixed;\r\n    left:50%;\r\n    top:50%;\r\n    -webkit-transform:translate3d(-50%,-50%,0);\r\n    transform:translate3d(-50%,-50%,0);\r\n}<\/pre>\n<p><b>\u7f3a\u70b9<\/b><br \/>\n\u79fb\u52a8\u7aef\u4e2d\u9891\u7e41\u7684\u4f7f\u7528\u5b9a\u4f4d\uff0c\u4f1a\u51fa\u73b0\u4e00\u4e9b\u83ab\u540d\u7684bug;<br \/>\nfixed+input\u5728ios\u4e0a\u5b58\u5728bug,\u4f1a\u51fa\u73b0\u4f7f\u7528fixed\u5e03\u5c40\u7684\u5143\u7d20\u4e71\u6389\u3002\u5728android\u624b\u673a\u4e0a\u5f53input\u6846\u83b7\u53d6\u7126\u70b9\u65f6\uff0c\u6362\u6c14\u952e\u76d8\uff0c\u4f1a\u51fa\u73b0\u5b9a\u4f4d\u7684\u5143\u7d20\u88ab\u62ac\u5347\u81f3\u624b\u673a\u952e\u76d8\u7684\u4e0a\u65b9\u3002<br \/>\n<b>5.\u6df7\u5408\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n\u6240\u8c13\u6df7\u5408\u5e03\u5c40\uff0c\u5c31\u662f\u628a\u6240\u6709\u5b66\u5230\u7684\u77e5\u8bc6\u7075\u6d3b\u8fd0\u7528\u5728\u5e03\u5c40\u4e2d\u3002\u4f8b\u5982\uff1arem+\u767e\u5206\u6bd4(\u6d41\u52a8\u5e03\u5c40)\u00a0\u00a0flex+rem\u7b49<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u5e03\u5c40\u7075\u6d3b\uff0c\u96c6\u5408\u5176\u4ed6\u5e03\u5c40\u7684\u4f18\u52bf\u8fbe\u5230\u81ea\u5df1\u7684\u5e03\u5c40\u8981\u6c42<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u4ee3\u7801\u6709\u70b9\u7d2f\u8d58\uff1b\u4ee3\u7801\u4e0d\u7edf\u4e00\uff0c\u7ef4\u62a4\u56f0\u96be<br \/>\n<b>6.flex\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n\u4e5f\u53eb\u5f39\u6027\u5e03\u5c40\u3002<\/p>\n<pre class=\"brush:js;toolbar:false\">\/*--\u53ea\u9700\u7236\u5143\u7d20\u8bbe\u7f6e--*\/\r\n{\r\n    display:-webkit-box;  \/*android2.1-3.0 ios 3.2-4.3*\/\r\n    display:-moz-box;  \/*firefox*\/\r\n    display:-webkit-flex;  \/*chrome 21+*\/\r\n    display:-ms-flexbox; \/*wp ie 10*\/\r\n    display:flex; \/*android 4.4*\/\r\n}\r\n\/*--\u7136\u540e\u5b50\u5143\u7d20\u8bbe\u7f6e\u76f8\u5e94\u7684\u6bd4\u4f8b--*\/\r\n{\r\n    -webkit-box-flex:1;\r\n    -webkit-flex:1;\r\n    -ms-flex:1;\r\n    flex:1;\r\n}<\/pre>\n<p>\u8fd9\u4e2a\u662f\u6700\u7b80\u5355\u7684flex\u5e03\u5c40\u4e86\uff0c\u5176\u5b9e\u5f39\u6027\u5e03\u5c40\u91cc\u9762\u8fd8\u6709\u5f88\u591a\u7b80\u5355\u9ad8\u6548\u5b9e\u7528\u7684\u5c5e\u6027\uff0c\u5f88\u65b9\u4fbf\u79fb\u52a8\u7aef\u7684\u5e03\u5c40\u3002<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u81ea\u9002\u5e94\u5f88\u597d\uff0c\u7075\u6d3b\u6027\u5f88\u5f3a\uff0c\u76ee\u524d\u5728\u79fb\u52a8\u7aef\u5e94\u7528\u7684\u8fd8\u662f\u6bd4\u8f83\u5e7f\u6cdb\u3002<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u9700\u8981\u5199\u5f88\u591a\u517c\u5bb9\u4ee3\u7801\u3002<br \/>\n<b>7.rem\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\nrem\u662f\u901a\u8fc7\u6839\u5143\u7d20\u8fdb\u884c\u9002\u914d\u7684\uff0c\u7f51\u9875\u4e2d\u7684\u6839\u5143\u7d20\u6307\u7684\u662fhtml\u6211\u4eec\u901a\u8fc7\u8bbe\u7f6ehtml\u7684font-size\u5927\u5c0f\u5c31\u53ef\u4ee5\u63a7\u5236rem\u7684\u5927\u5c0f\u3002\u6709\u4ee5\u4e0b\u4e24\u79cd\u9002\u914d\u65b9\u5f0f\uff1a<br \/>\n1.rem+@media(\u901a\u8fc7\u5a92\u4f53\u67e5\u8be2\u8bbe\u7f6ehtml\u7684font-size\u503c\uff0c\u8fbe\u5230\u81ea\u9002\u5e94)<\/p>\n<pre class=\"brush:js;toolbar:false\">html{\r\n    -webkit-text-size-adjust:none; \r\n    font-size:10px;\r\n}\r\n@media screen and (min-width:321px) and (max-width:375px){\r\n    html{\r\n        font-size:10px;\r\n    }\r\n}\r\n@media screen and (min-width:376px) and (max-width:414px){\r\n    html{\r\n        font-size:10.25px;\r\n    }\r\n}\r\n@media screen and (min-width:415px) and (max-width:454px){\r\n    html{\r\n        font-size:10.5px;\r\n    }\r\n}\r\n@media screen and (min-width:455px) and (max-width:554px){\r\n    html{\r\n        font-size:10.75px;\r\n    }\r\n}\r\n@media screen and (min-width:455px){\r\n    html{\r\n        font-size:11px;\r\n    }\r\n}<\/pre>\n<p>2.rem+js\uff08\u901a\u8fc7js\u81ea\u52a8\u83b7\u53d6\u8bbe\u5907\u5bbd\u5ea6\uff0c\u8ba1\u7b97\u5f97\u5230\u76f8\u5e94\u8bbe\u5907\u4e0bhtml\u7684font-size\u503c\u8fbe\u5230\u81ea\u9002\u5e94\uff09<\/p>\n<pre class=\"brush:js;toolbar:false\">!function(n) {\r\n    var e = n.document,\r\n    t = e.documentElement,\r\n    i = 720,\r\n    d = i \/ 100,\r\n    o = \"orientationchange\" in n ? \"orientationchange\": \"resize\",\r\n    a = function() {\r\n        var n = t.clientWidth || 320;\r\n        n &gt; 720 &amp;&amp; (n = 720),\r\n        t.style.fontSize = n \/ d + \"px\"\r\n    };\r\n    e.addEventListener &amp;&amp; (n.addEventListener(o, a, !1), e.addEventListener(\"DOMContentLoaded\", a, !1))\r\n} (window);<\/pre>\n<p><b>\u4f18\u70b9<\/b><br \/>\n\u5728\u4efb\u4f55\u8bbe\u5907\u4e0b\u90fd\u53ef\u4ee5\u8fbe\u5230\u5b8c\u5168\u9002\u914d\uff0c\u9875\u9762\u5e03\u5c40\u6837\u5f0f\u5b8c\u5168\u81ea\u9002\u5e94<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\nrem+@media\u8fd9\u79cd\u65b9\u5f0f\u4e0d\u80fd\u6240\u6709\u8bbe\u5907\u5168\u9002\u914d<br \/>\n<b>8.\u54cd\u5e94\u5f0f\u5e03\u5c40<\/b><br \/>\n<b>\u65b9\u6cd5<\/b><br \/>\n\u4f7f\u7528@media(\u5a92\u4f53\u67e5\u8be2)\u8bbe\u7f6e\u9875\u9762\u5728\u4e0d\u540c\u7684\u5c4f\u5e55\u5bbd\u5ea6\u4e0b\u8fbe\u5230\u81ea\u9002\u5e94\u4ee5\u53ca\u54cd\u5e94\u5f0f\uff08\u6839\u636e\u4e0d\u540c\u5c4f\u5e55\u5927\u5c0f\uff0c\u9875\u9762\u5e03\u5c40\uff0c\u6837\u5f0f\u4f1a\u505a\u51fa\u76f8\u5e94\u7684\u8c03\u6574\uff09\u5178\u578b\u6848\u4f8b\uff08bootStrap\u5b98\u7f51\uff09<br \/>\n<b>\u4f18\u70b9<\/b><br \/>\n\u4e0d\u4ec5\u5728\u4e0d\u540c\u7684\u5c4f\u5e55\u4e0b\u8fbe\u5230\u81ea\u9002\u5e94\uff0c\u8fd8\u4f1a\u5728\u76f8\u5e94\u7684\u5c4f\u5e55\u4e0b\u5bf9\u9875\u9762\u5e03\u5c40\uff0c\u6837\u5f0f\u505a\u51fa\u76f8\u5e94\u7684\u8c03\u6574\uff0c\u8fbe\u5230\u66f4\u52a0\u7684\u7528\u6237\u4f53\u9a8c<br \/>\n<b>\u7f3a\u70b9<\/b><br \/>\n\u517c\u5bb9\u5404\u79cd\u8bbe\u5907\u5de5\u4f5c\u91cf\u5927\uff0c\u6548\u7387\u4f4e\u4e0b\uff1b\u4ee3\u7801\u7d2f\u8d58\uff0c\u4f1a\u51fa\u73b0\u9690\u85cf\u65e0\u7528\u7684\u5143\u7d20\uff0c\u52a0\u8f7d\u65f6\u95f4\u8fc7\u957f\uff1b\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u6539\u53d8\u4e86\u7f51\u7ad9\u539f\u6709\u7684\u5e03\u5c40\u7ed3\u6784\uff0c\u4f1a\u51fa\u73b0\u7528\u6237\u6df7\u6dc6\u7684\u60c5\u51b5\uff1b\u589e\u52a0UI\u548c\u5f00\u53d1\u7684\u5de5\u4f5c\u91cf\u3002<\/p>\n<p class=\"post-copyright\">\u6b22\u8fce\u5206\u4eab\u672c\u6587\uff0c\u8f6c\u8f7d\u8bf7\u4fdd\u7559\u51fa\u5904\uff1a<a href=\"http:\/\/www.qdabc.cn\">\u524d\u7aefABC<\/a> &raquo; <a href=\"http:\/\/www.qdabc.cn\/?p=675\">\u79fb\u52a8\u7aef\u9875\u9762\u91cd\u6784\u5e03\u5c40\uff08layout\uff09<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u6211\u5c06\u7b80\u5355\u7684\u4ecb\u7ecd\u79fb\u52a8\u7aef\u5e03\u5c40\u7684\u516b\u79cd\u65b9\u5f0f\uff1a 1.\u56fa\u5b9a\u5e03\u5c40 2.\u6d41\u52a8\u5e03\u5c40 3.\u6d6e\u52a8\u5e03\u5c40 4.\u5b9a\u4f4d\u5e03\u5c40 5.\u6df7\u5408\u5e03\u5c40 6.flex\u5e03\u5c40 7.rem\u5e03\u5c40 8.\u54cd\u5e94\u5f0f\u5e03\u5c40 1.\u56fa\u5b9a\u5e03\u5c40 \u65b9\u6cd5 &lt;head&#038; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":325,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[29,15,169],"_links":{"self":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/675"}],"collection":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=675"}],"version-history":[{"count":1,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/675\/revisions"}],"predecessor-version":[{"id":676,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/posts\/675\/revisions\/676"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=\/wp\/v2\/media\/325"}],"wp:attachment":[{"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=675"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qdabc.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}