常用主流移动设备CSS3 Media Queries整理
2016-06-22 09:45
627 查看
常用主流移动设备CSS3 Media Queries整理
使用的时候根据实际的需要进行条件判断,其中landscape 表示设备 横屏 情况 ,portrait 表示设备 竖屏 情况
max-device-width 表示设备最大分辨率宽度,min-device-width 表示设备最小分辨率宽度
关于 min-width 和 min-device-width 的区别是,前者是指的网页窗口的最小宽度,后者是指设备最小分辨率宽度,同理 max-width 和 max-device-width,前者是指网页窗口的最大宽度,后者是指设备最大分辨率宽度。
值得注意的是 我们在写设备页面适配的时候,不要忘记加上这句,要不然页面在PC端模拟测试是没有效果的。
<meta name="viewport" content="width=device-width,user-scalable=no" />
意思是:设置屏幕宽度为设备宽度,禁止用户手动调整缩放,关于viewpotr其他具体参数设置,可以百度查阅。
代码如下
@charset "utf-8"; /** * iPhone 4/4s landscape & portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) { } /** * iPhone 4/4s portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (orientation:portrait) { } /** * iPhone 4/4s landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 480px) and (orientation:landscape) { } /** * iPhone 5/5s landscape & portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) { } /** * iPhone 5/5s portrait */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (orientation: portrait) { } /** * iPhone 5/5s landscape */ @media only screen and (min-device-width: 320px) and (max-device-width: 568px) and (orientation: landscape) { } /** * iPhone 6 landscape & Portrait */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) { } /** * iPhone 6 Portrait */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : portrait) { } /** * iPhone 6 landscape */ @media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (orientation : landscape) { } /** * iPhone 6+ Portrait */ @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : portrait) { } /** * iPhone 6+ landscape */ @media only screen and (min-device-width: 414px) and (max-device-width: 736px) and (orientation : landscape) { } /** * Galaxy S3 landscape & portrait */ @media screen and (device-width: 320px) and (device-height: 640px) { } /** * Galaxy S3 portrait */ @media screen and (device-width: 320px) and (device-height: 640px) and (orientation: portrait) { } /** * Galaxy S3 landscape */ @media screen and (device-width: 320px) and (device-height: 640px) and (orientation: landscape) { } /** * Galaxy S5 landscape & portrait */ @media screen and (device-width: 360px) and (device-height: 640px) { } /** * Galaxy S5 portrait */ @media screen and (device-width: 360px) and (device-height: 640px) and (orientation: portrait) { } /** * Galaxy S5 landscape */ @media screen and (device-width: 360px) and (device-height: 640px) and (orientation: landscape) { } /** * iPad landscape & portrait */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (-webkit-min-device-pixel-ratio: 1) { } /** * iPad portrait */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 1) { } /** * iPad landscape */ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 1) { }
以上代码主要针对 主流的移动 苹果设备 和 安卓设备 进行整理的
整理的目的是方便自己需要时查阅,也同时分享给需要的小伙伴,代码片段参考网上资源,并再加以说明和修改。
如有问题,希望看后的小伙伴可以帮忙指出,共同进步
相关文章推荐
- 在Windows 8.1的IE 11中屏蔽双击放大功能
- HTML5调用摄像头实例
- Powershell 创建炫丽美观的Html报表
- Apple官网研究之使用Justify布局导航
- 关于前端的思考与感悟
- 又被事件冒泡坑了一把,这次要彻底弄懂浏览器的事件流
- 通过Mootools 1.2来操纵HTML DOM元素
- jQuery Html控件基本操作(日常收集整理)
- WEB标准网页布局中尽量不要使用的HTML标签
- Flash 与 html 的一些实用技巧
- html工作中表格<tbody>标签的使用技巧
- HTML 向 XHTML1.0 兼容性指导
- C#自写的一个HTML解析类(类似XElement语法)
- 没有文件大小限制并免费的PDF到HTML转换工具
- JavaScript与HTML结合的基本使用方法整理
- Ruby编写HTML脚本替换小程序的实例分享
- css实现气泡框效果(实例加图解)
- html链接与文本标签们
- html活用软字符连接符