2013-07-25 83 views
1

我是使用媒体查询的新手。 我正在一个网站上工作,我希望它能在iPad上正确显示。媒体查询不适用于Ipad

I have tried this, 

//css use for Ipad 

    @media only screen 
    and (min-device-width : 768px) 
    and (max-device-width : 1024px) { 
     .overlayBox{ 
      width:200px; 
     } 
    } 


// css use for Window 
    .overlayBox{ 
     width:450px; 
    } 

但我有问题,媒体查询不适用于Ipad。它需要窗口CSS。 我做错了什么?

+0

你添加了这个吗? ' – Nitesh

+0

Tablet portrait:@media only screen and(min-width:768px)and(max-width:999px) – DarkBee

+0

@NathanLee:我尝试但不工作。 – Kango

回答

1

使用device-widthdevice-height来定位特定设备,然后使用orientation来定位纵向或横向。

@media only screen and (device-width: 768px) and (device-height: 1024px) and (orientation: portrait) { 
    .myrules { 
     width: 200px; 
    } 
}