[英]@media query weirdness with “or” and iPhone
If I use this query (iPhone retina) 如果我使用此查询(iPhone视网膜)
#clickme
{
font-size: 200%;
position: absolute;
top: 50px;
left: 50px;
width: 200px;
height: 100px;
background-color: red;
}
@media (min-device-width: 480px)
{
#clickme
{
font-size: 100%;
position: absolute;
top: 50px;
left: 50px;
width: 100px;
height: 50px;
background-color: green;
}
}
the color is red, but if I add an or clause 颜色是红色,但是如果我添加or子句
@media (min-device-width: 480px) or (orientation: landscape)
{
#clickme
{
font-size: 100%;
position: absolute;
top: 50px;
left: 50px;
width: 100px;
height: 50px;
background-color: green;
}
}
and the device is in portrait, the button is green 并且设备为纵向,按钮为绿色
Is this fixable without resorting to separate queries? 这可以解决而无需诉诸单独的查询吗?
or
is not a valid keyword in media queries. or
在媒体查询中不是有效的关键字。
You'll need to have separate media queries, but to group them together with a logical OR, use a comma: 您需要有单独的媒体查询,但要将它们与逻辑或分组在一起,请使用逗号:
@media (min-device-width: 480px), (orientation: landscape)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.