2012-07-19 242 views
0

由于某些原因,当我从iPhone或移动设备上查看时,我的媒体查询不能正确调整我的网站的大小,因此我在iphone上获取了该网站的平板电脑版本。媒体查询适用于平板电脑,适用于缩小浏览器窗口的情况。媒体查询CSS

我错过了什么吗?

@media only screen and (min-width: 1024px) { 
/*styling here*/ 
} 

@media only screen and (max-width: 1023px) and (min-width: 740px) { 
/*Tablet styling here*/ 
} 

@media only screen and (max-width: 739px) and (min-width: 0px) { 
/*Mobile styling here*/ 
} 
+0

看起来不错。您可以尝试LESS骨架样式表:http://lessframework.com/ – approxiblue 2012-07-19 12:39:40

+0

确保移动浏览器想要提供移动版本的网站。如果用户选择不这样做,浏览器将使用更高的屏幕宽度并解析正常的样式表。 – 2012-07-19 12:41:14

+0

尝试首先写入小型设备,然后获取更高分辨率并使用元视口。希望所有这些帮助你。 – SVS 2012-07-19 12:46:14

回答

0

离店this, ,让我知道无论是工作或没有

您需要指定设备宽度。

+0

[另一个相关资源](http://www.stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/) – 2012-07-19 12:49:26

+0

使用设备宽度似乎不工作,也许是因为我使用了一个名为MITE的虚拟测试仪? – davey 2012-07-19 12:53:29

+0

[Virtual Tester](http://www.responsinator.com/) – 2012-07-23 04:33:16

0

我想你可能需要指定它为'min-device-width'。

@media only screen and (max-device-width: 739px) and (min-device-width: 0px) { 
    /*Mobile styling here*/ 
}