如何合并两个媒体查询? [英] How do I combine two media queries?

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

问题描述

如何合并两个媒体查询?一种是用于较小的设备,另一种是用于较大的设备,但只能在纵向模式下!

How do I combine two media queries? One is for smaller devices and one for bigger devices, but only in portrait mode!

 @media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) 
and (orientation : landscape){
#div {margin-top: 20px;}
}

}
@media only screen 
and (min-device-width : 481px) 
and (max-device-width : 1024px) 
and (orientation : portrait){
{margin-top: 20px;}
}

推荐答案

不清楚要合并的内容,但基本上是用逗号隔开的

Not fully clear what you want to combine, but basically you separate them with a comma

例如

@media only screen and (orientation : landscape) , only screen and (min-device-width : 481px) and (orientation : portrait) { ...

这篇关于如何合并两个媒体查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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