css - 我可以伪造 css 媒体只用 firefox 屏幕吗?

标签 css ipad

我有一个网站给我的 ipad 查看带来了不必要的问题。 (如果您检查了许多其他问题并有解决问题的想法,那么您就是我的英雄!)

为了解决这个问题,我尝试在我的电脑上使用 firefox 查看我的网站,以查看在使用我的 ipad(带有 firebug 插件)时大小如何。

问题:在我的 CSS 中,我使用: @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation:landscape){ ...

不过,这似乎并没有被 firefox 接受。对于 Firefox,我在这里使用插件: http://chrispederick.com/work/user-agent-switcher/

定义了一个名为 ipad 的新类型,如下所示: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 (我没有更改其他值,只是更改了“user-agent”选项。不过,其他网站认为我是“ipad”,所以我认为它有效)

但是,我的 css 文件没有被提取(或者更确切地说,修改后的版本没有通过)。这可能是: firebug 的问题,正在渲染 css 或者 用户代理切换器的问题,以及计算出要使用哪个 css 的东西 - 无论它是什么 - 知道我在 ff for pc 或者 我的 CSS 切换有问题吗?

干杯!

最佳答案

看看CSS3 media query not working第二个答案可以解决你的问题

基本上,想法是将 (min|max)-device-width 更改为 (min|max)-width

来自 http://css-tricks.com/resolution-specific-stylesheets/

Keep in mind this is the device width, not the current width of the browser window. On the iPhone (3G(s)), that means 480px. My fancy new MacBook Pro is going to return 1920px for the device width. But my actual browser window is only half of that at this exact moment. The device width is quite useful when dealing with mobile devices where the browser is probably 100% of the screen whenever in use, but less useful in laptop/desktop browsers.

关于css - 我可以伪造 css 媒体只用 firefox 屏幕吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8698542/

相关文章:

iphone - 如何在发布前测试更新过程?

javascript - 如何使用列值和行值突出显示/着色表 td?

jquery - 谷歌翻译小部件移动溢出

javascript - 使用 Bootstrap 时创建视频标题

objective-c - 需要 iOS 的教程才能在我的应用程序中播放视频文件

iphone - iOS : Slow searching in SQLite database

javascript - Div 隐藏在 Flash 内容后面

html - CSS3 与 Angular Material CSS

"-webkit-overflow-"滚动 :touch;"the scrolling just stops working sometimes… 的 iPad 网站

iPad:在RootView中合并SplitViewController和NavigationController的概念?