{"id":2034,"date":"2018-11-19T21:35:35","date_gmt":"2018-11-19T13:35:35","guid":{"rendered":"https:\/\/www.baishitou.cn\/?p=2034"},"modified":"2018-11-19T21:35:35","modified_gmt":"2018-11-19T13:35:35","slug":"css%e6%a0%b7%e5%bc%8f%e9%87%8c%e9%9d%a2%e7%9a%84media%e4%b8%8emedia-screen%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/www.baishitou.cn\/2034.html","title":{"rendered":"css\u6837\u5f0f\u91cc\u9762\u7684@media\u4e0e@media screen\u7684\u533a\u522b"},"content":{"rendered":"

\u5728\u7f51\u7ad9\u81ea\u9002\u5e94\u8bbe\u8ba1\u4e2d\uff0c@media\u4e0e@media\u00a0 screen\u662f\u5fc5\u987b\u7528\u5230\u7684css\u4ee3\u7801\uff0c\u53ef\u80fd\u5927\u5bb6\u5bf9\u6b64\u5e76\u4e0d\u964c\u751f\u3002\u4f46\u662f\u5927\u5bb6\u53c8\u77e5\u4e0d\u77e5\u9053@media\u4e0e@media\u00a0 screen\u7684\u533a\u522b\u5728\u54ea\u5462\uff1f\u5728\u81ea\u9002\u5e94\u8bbe\u8ba1\u4e2d\u4f60\u662f\u7528@media\u8fd8\u662f\u7528@media\u00a0 screen\uff1f\u4f60\u77e5\u4e0d\u77e5\u9053\u4e24\u8005\u4ea7\u751f\u7684\u7ed3\u679c\u6709\u4ec0\u4e48\u4e0d\u540c\u5462\uff1f\u8fd9\u4e9b\u95ee\u9898\u6211\u60f3\u5f88\u591a\u4eba\u90fd\u4e0d\u6e05\u695a\u5427\u3002\u672c\u6587\u4fbf\u901a\u8fc7\u5b9e\u4f8b\u7ed9\u4f60\u8bf4\u8bf4@media\u4e0e@media\u00a0 screen\u7684\u533a\u522b\uff0c\u4e3b\u8981\u662f\u544a\u8bc9\u4f60\u5b83\u4eec\u4ea7\u751f\u7684\u6548\u679c\u533a\u522b\u5728\u54ea\u3002<\/p>\n

@media\u4e0e@media\u00a0 screen\u624b\u673a\u7f51\u9875\u533a\u522b<\/strong><\/p>\n

\u597d\u5427\uff0c\u7406\u8bba\u65b9\u9762\u6682\u65f6\u653e\u5728\u4e00\u8fb9\uff0c\u5148\u770b\u770b\u4e24\u8005\u4ea7\u751f\u7684\u624b\u673a\u7f51\u9875\u89c6\u56fe\u6709\u4ec0\u4e48\u4e0d\u540c\u3002<\/p>\n

\"\"<\/a><\/p>\n

@media\u4e0e@media\u00a0 screen\u624b\u673a\u7f51\u9875<\/p>\n

\u4e0a\u56fe\u770b\u51fa\uff0c\u6ca1\u6709\u4efb\u4f55\u533a\u522b\u3002\u6ca1\u9519\uff0c\u786e\u5b9e\u6ca1\u6709\u4efb\u4f55\u533a\u522b\uff0c\u56e0\u4e3a@media\u4e0e@media\u00a0 screen\u7684css\u5728\u624b\u673a\u8bbe\u5907\u91cc\u90fd\u662f\u6709\u6548\u7684\u3002<\/p>\n

@media\u4e0e@media\u00a0 screen\u6253\u5370\u7f51\u9875\u533a\u522b<\/strong><\/p>\n

\u4e24\u8005\u5728\u624b\u673a\u8bbe\u5907\u4e0a\u6ca1\u6709\u533a\u522b\uff0c\u5728\u6253\u5370\u8bbe\u5907\u4e0a\u662f\u600e\u6837\u7684\u5462\uff1f\u770b\u770b\u5982\u4e0b\u622a\u56fe\u3002<\/p>\n

\"\"<\/a><\/p>\n

@media\u6253\u5370\u7f51\u9875<\/p>\n

\"\"<\/a><\/p>\n

@media\u00a0 screen\u6253\u5370\u7f51\u9875<\/p>\n

\u5f88\u660e\u663e\uff0c\u4e24\u8005\u7684\u6253\u5370\u6548\u679c\u662f\u4e0d\u540c\u7684\u3002<\/p>\n

\u81f3\u6b64\uff0c\u6211\u4eec\u5e94\u8be5\u660e\u767d\u4e86@media\u4e0e@media\u00a0 screen\u7684\u533a\u522b\u4e86\u5427\uff0c\u6ca1\u9519\uff0c@media\u00a0 screen\u7684css\u5728\u6253\u5370\u8bbe\u5907\u91cc\u662f\u65e0\u6548\u7684\uff0c\u800c@media\u5728\u6253\u5370\u8bbe\u5907\u91cc\u662f\u6709\u6548\u7684\uff0c\u8fd9\u5c31\u662f\u5b83\u4eec\u7684\u533a\u522b\u4e86\u3002<\/p>\n

\u77e5\u9053\u4e86\u5b83\u4eec\u7684\u533a\u522b\uff0c\u6211\u4eec\u5c31\u5e94\u8be5\u61c2\u5f97\u5982\u4f55\u4f7f\u7528\u5b83\u4eec\u4e86\u3002\u5982\u679ccss\u9700\u8981\u7528\u5728\u6253\u5370\u8bbe\u5907\u91cc\uff0c\u90a3\u4e48\u5c31\u7528@media\u00a0\uff0c\u5426\u5219\uff0c\u5c31\u7528@media\u00a0 screen\u3002<\/p>\n

\u4e0d\u8fc7\u8fd9\u53ea\u662f\u7b3c\u7edf\u7684\u505a\u6cd5\uff0c\u5176\u5b9e\u5982\u679c\u628a\u201cscreen\u201d\u6362\u4e3a\u201cprint\u201d\uff0c\u5199\u4e3a@media\u00a0 print<\/strong>\uff0c\u90a3\u4e48\u8be5css\u5c31\u53ef\u7528\u5230\u6253\u5370\u8bbe\u5907\u4e0a\u4e86\uff0c\u4f46\u8981\u6ce8\u610f\uff0c@media\u00a0 print<\/strong>\u58f0\u660e\u7684css\u53ea\u80fd\u5728\u6253\u5370\u8bbe\u5907\u4e0a\u6709\u6548\u54e6\u3002<\/p>\n

\u901a\u8fc7\u6b64\u5b9e\u4f8b\u7684\u89c1\u89e3\uff0c\u6211\u4eec\u53ef\u4ee5\u4e3e\u4e00\u53cd\u4e09\uff0c\u5bf9@media\u7684\u7528\u6cd5\u5c31\u80fd\u66f4\u6613\u63a5\u53d7\u4e86\u3002\u4e0b\u9762\u7684\u77e5\u8bc6\u6269\u5c55\u53ef\u4ee5\u8ba9\u4f60\u66f4\u6df1\u5165\u5730\u4e86\u89e3@media\u7684\u5404\u79cd\u7528\u6cd5\u3002<\/p>\n

\u77e5\u8bc6\u6269\u5c55<\/strong><\/p>\n

@media only screen and<\/strong><\/p>\n

only(\u9650\u5b9a\u67d0\u79cd\u8bbe\u5907)
\nscreen \u662f\u5a92\u4f53\u7c7b\u578b\u91cc\u7684\u4e00\u79cd
\nand \u88ab\u79f0\u4e3a\u5173\u952e\u5b57\uff0c\u5176\u4ed6\u5173\u952e\u5b57\u8fd8\u5305\u62ec not(\u6392\u9664\u67d0\u79cd\u8bbe\u5907)<\/p>\n

\/* \u5e38\u7528\u7c7b\u578b *\/<\/strong>
\n\u7c7b\u578b \u89e3\u91ca
\nall\u00a0\u6240\u6709\u8bbe\u5907
\nbraille\u00a0\u76f2\u6587
\nembossed\u00a0\u76f2\u6587\u6253\u5370
\nhandheld\u00a0\u624b\u6301\u8bbe\u5907
\nprint\u00a0\u6587\u6863\u6253\u5370\u6216\u6253\u5370\u9884\u89c8\u6a21\u5f0f
\nprojection\u00a0\u9879\u76ee\u6f14\u793a\uff0c\u6bd4\u5982\u5e7b\u706f
\nscreen\u00a0\u5f69\u8272\u7535\u8111\u5c4f\u5e55
\nspeech\u00a0\u6f14\u8bb2
\ntty\u00a0\u56fa\u5b9a\u5b57\u6bcd\u95f4\u8ddd\u7684\u7f51\u683c\u7684\u5a92\u4f53\uff0c\u6bd4\u5982\u7535\u4f20\u6253\u5b57\u673a
\ntv\u00a0\u7535\u89c6<\/p>\n

screen\u4e00\u822c\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u4e0b\u9762\u662f\u6211\u81ea\u5df1\u7684\u5c1d\u8bd5\uff0c\u5217\u51fa\u5e38\u7528\u7684\u8bbe\u5907\u7684\u5c3a\u5bf8\uff0c\u7136\u540e\u7ed9\u9875\u9762\u5206\u4e86\u51e0\u4e2a\u5c3a\u5bf8\u7684\u7248\u672c\u3002<\/p>\n

\/* \u5e38\u7528\u8bbe\u5907 *\/
\n<\/strong>\u8bbe\u5907 \u5c4f\u5e55\u5c3a\u5bf8
\n\u663e\u793a\u5668 1280 x 800
\nipad 1024 x 768
\nAndroid 800 x 480
\niPhone 640 x 960<\/p>\n

\u4e24\u79cd\u65b9\u5f0f<\/strong><\/p>\n

a\uff1a<link rel=\"stylesheet\" type=\"text\/css\" href=\"styleB.css\" media=\"screen and (min-width: 600px) and (max-width: 800px)\"><\/code><\/p>\n

\u610f\u601d\u662f\u5f53\u5c4f\u5e55\u7684\u5bbd\u5ea6\u5927\u4e8e600\u5c0f\u4e8e800\u65f6\uff0c\u5e94\u7528styleB.css<\/p>\n

b\uff1a<\/p>\n

@media screen and (max-width: 600px) {  \/*\u5f53\u5c4f\u5e55\u5c3a\u5bf8\u5c0f\u4e8e600px\u65f6\uff0c\u5e94\u7528\u4e0b\u9762\u7684CSS\u6837\u5f0f*\/\r\n  .class {\r\n    background: #ccc;\r\n  }\r\n}<\/code><\/pre>\n

 <\/p>\n

device-aspect-ratio<\/strong><\/p>\n

device-aspect-ratio\u53ef\u4ee5\u7528\u6765\u9002\u914d\u7279\u5b9a\u5c4f\u5e55\u957f\u5bbd\u6bd4\u7684\u8bbe\u5907\uff0c\u8fd9\u4e5f\u662f\u4e00\u4e2a\u5f88\u6709\u7528\u7684\u5c5e\u6027\uff0c\u6bd4\u5982\uff0c\u6211\u4eec\u7684\u9875\u9762\u60f3\u8981\u5bf9\u957f\u5bbd\u6bd4\u4e3a4:3\u7684\u666e\u901a\u5c4f\u5e55\u5b9a\u4e49\u4e00\u79cd\u6837\u5f0f\uff0c\u7136\u540e\u5bf9\u4e8e16:9\u548c16:10\u7684\u5bbd\u5c4f\uff0c\u5b9a\u4e49\u53e6\u4e00\u79cd\u6837\u5f0f\uff0c\u6bd4\u5982\u81ea\u9002\u5e94\u5bbd\u5ea6\u548c\u56fa\u5b9a\u5bbd\u5ea6\uff1a<\/p>\n

@media only screen and (device-aspect-ratio:4\/3)<\/code><\/pre>\n

 <\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728\u7f51\u7ad9\u81ea\u9002\u5e94\u8bbe\u8ba1\u4e2d\uff0c@media\u4e0e@media\u00a0 screen\u662f\u5fc5\u987b\u7528\u5230\u7684css\u4ee3\u7801\uff0c\u53ef\u80fd\u5927\u5bb6\u5bf9\u6b64\u5e76\u4e0d\u964c\u751f\u3002\u4f46 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[669,679,678,663],"class_list":["post-2034","post","type-post","status-publish","format-standard","hentry","category-web","tag-media","tag-media-screen","tag-css","tag-663"],"_links":{"self":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2034","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=2034"}],"version-history":[{"count":0,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/posts\/2034\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/media?parent=2034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/categories?post=2034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.baishitou.cn\/wp-json\/wp\/v2\/tags?post=2034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}