
Fiddle link
HTML:
<div align="center"> <h3>Three Levels </h3> </div> <div align="center"> </div><br/><br/> <div align="center"> </div><br/><br/> <div align="center"> </div><br/><br/> <button>Play</button>
任何建议请,
解决方法 这叫做 Responsive Web Development(RWD).为了使页面响应所有设备,我们需要使用一些基本的基础,如:
1.将headport元标签设置在head中:
<Meta name="vIEwport" content="wIDth=device-wIDth,height=device-height,initial-scale=1.0"/>
2.使用media queries.
例:-
/* Smartphones (portrait and landscape) ----------- */@media only screen and (min-device-wIDth : 320px) and (max-device-wIDth : 480px) {/* Styles */}/* Smartphones (landscape) ----------- */@media only screen and (min-wIDth : 321px) {/* Styles */}/* Smartphones (portrait) ----------- */@media only screen and (max-wIDth : 320px) {/* Styles */}/* iPads (portrait and landscape) ----------- */@media only screen and (min-device-wIDth : 768px) and (max-device-wIDth : 1024px) {/* Styles */}/* iPads (landscape) ----------- */@media only screen and (min-device-wIDth : 768px) and (max-device-wIDth : 1024px) and (orIEntation : landscape) {/* Styles */}/* iPads (portrait) ----------- */@media only screen and (min-device-wIDth : 768px) and (max-device-wIDth : 1024px) and (orIEntation : portrait) {/* Styles */}/* Desktops and laptops ----------- */@media only screen and (min-wIDth : 1224px) {/* Styles */}/* Large screens ----------- */@media only screen and (min-wIDth : 1824px) {/* Styles */}/* iPhone 4 ----------- */@mediaonly screen and (-webkit-min-device-pixel-ratio : 1.5),only screen and (min-device-pixel-ratio : 1.5) {/* Styles */} 或者我们可以直接使用RWD framework:
> Bootstrap
> Foundation 3 etc.
一些好文章
Media Queries for Standard Devices – BY CHRIS COYIER
CSS Media Dimensions
更大的设备,中型设备&小型设备媒体查询. (在我的场景中工作)
以下媒体查询通用设备类型: – 较大的设备,中型设备&小型设备.
这只是基本的媒体类型,适用于所有的场景&容易处理代码而不是使用各种媒体查询只需要关心三种媒体类型.
/*###Desktops,big landscape tablets and laptops(Large,Extra large)####*/@media screen and (min-wIDth: 1024px){/*Style*/}/*###tablet(medium)###*/@media screen and (min-wIDth : 768px) and (max-wIDth : 1023px){/*Style*/}/*### Smartphones (portrait and landscape)(small)### */@media screen and (min-wIDth : 0px) and (max-wIDth : 767px){/*Style*/} 总结 以上是内存溢出为你收集整理的html – 如何自动调整所有手机/平板电脑显示格式的尺寸?全部内容,希望文章能够帮你解决html – 如何自动调整所有手机/平板电脑显示格式的尺寸?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)