ios - iOS 7 中的媒体查询不起作用

标签 ios media ios7

我正在使用一些针对 iPad 和 iPhone 的横向和纵向媒体查询,但从 iOS 7 开始,它们不再起作用。不过,它们在 iOS 6 中运行良好。有没有人有类似的经历?

这是我正在使用的部分代码:

<style type="text/css">
/* iPad (landscape) */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
.header {
font-family: courier new, monospace;
color: #999999;
font-size: 14pt;
line-height: 104%;
width: 37.5em; }
.action {  
font-family: courier new, monospace;
color: #999999;
font-size: 14pt;
line-height: 104%;
width: 37.5em; }
.character {  
font-family: courier new, monospace;  
color: #999999;
font-size: 14pt;
line-height: 104%;
padding-left: 12.25em;
width: 21em; }
.dialogue {
font-family: courier new, monospace;  
color: #999999;
font-size: 14pt;
line-height: 104%;
padding-left: 6.15em;
width: 22em; }
.info {  
display: none; }}
/* iPad (portrait) */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
.header {
font-family: courier new, monospace;
color: #999999;
font-size: 12pt;
line-height: 104%;
width: 37.15em; }
.action {  
font-family: courier new, monospace;
color: #999999;
font-size: 12pt;
line-height: 104%;
width: 37.15em; }
.character {  
font-family: courier new, monospace;  
color: #999999;
font-size: 12pt;
line-height: 104%;
padding-left: 12em;
width: 21em; }
.dialogue {
font-family: courier new, monospace;  
color: #999999;
font-size: 12pt;
line-height: 104%;
padding-left: 6em;
width: 22em; }
.info {  
display: none; }}
</style>

最佳答案

<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />

确保您的 html 代码包含此行。

关于ios - iOS 7 中的媒体查询不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18952156/

相关文章:

ios - 无法在 BrowserStack Automate 上使用 iOS 设备加载本地主机上的网站

iphone - 如果部署目标 < 基本 sdk,如何检查是否使用了不可用的方法?

python - 从 Perl 中的链接检索媒体(图像、视频等)

css - 使用 css 设计用于打印的网站

ios - UISearchBar 着色在 iOS7 上不一致

ios - BLE 在后台

iOS 7 Dev - @synthesize 不自动创建 ivars

ios - id<protocol> someObject 和 NSObject<protocol> *someObject 的区别

Django 媒体文件在生产中未显示为 Debug = False - Django 1.10

ios - 在 Swift 中使用 Reachability、NSNotification 和 Network Link Conditioner 检测网络连接变化