2012-03-13 112 views
0

我正在使用css媒体查询来检测iPad上的肖像模式,并将定位样式应用于具有固定或绝对定位的div,我试过都无济于事。查询正在工作,但div不会以纵向模式为中心。它将在风景中完美地居中。Ipad以肖像模式居中,在横向模式下工作

您可以查看站点住在http://goodmorningmoon.ca通:springy88

这里是我的代码

@media only screen and (max-device-width: 1024px) and (orientation:portrait) { 
    #logo{ position:absolute; left:50%; width:160px; margin-left:80px;} 

} 

谢谢!提前。

回答

1

我错过了阴性符号哎呀

@media only screen and (max-device-width: 1024px) and (orientation:portrait) { 

    #logo{position:absolute; width:160px; margin-left:-80px; left:50%; } 

} 
0

当前的查询使用max-device-width - 这属性指的是设备screen-width;它不会根据浏览器窗口的方向或大小而改变。 max-width指的是实际的浏览器窗口,在这种情况下会给你想要的结果。

您可以在this topic here

相关问题