定义CSS媒体查询 [英] Defining CSS Media Queries

查看:100
本文介绍了定义CSS媒体查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下媒体查询在移动设备和计算机上的行为是否完全相同,还是有区别?

Will the following media queries behave exactly same on mobile devices and computers or there's any difference?

@media only screen and (max-width: 480px), 
screen and (max-device-width: 480px){
...
}

@media (max-width: 480px) {
..
}


推荐答案

不,他们不会。这是因为 device-width width 不同。如果您的媒体查询只有 width ,它们的行为会一样,但是当您引入 device-width 得到不同的结果。有关详情,请参阅我对此问题的回复: CSS定位iPhone iPad的样式表不起作用

No, they will not. This is because device-width is not the same as width. If your media query has just width they'll behave the same, but when you introduce device-width you'll get different results. Refer to my response to this question for more info: CSS stylesheet that targets iPhone iPad not working

这篇关于定义CSS媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆