У меня проблема с использованием медиа-запросов CSS вместе с метатегом области просмотра. Я делаю веб-приложение для iPad, которое будет работать в автономном режиме на главном экране.
Это CSS:
.header_portrait {
position: relative;
top: 0px;
left: 0px;
background: #ccc;
width: 1536px;
height: 219px;
}
.header_landscape {
position: relative;
top: 0px;
left: 0px;
background: #fff;
width: 1536px;
height: 219px;
}
@media only screen and (max-device-width: 1024px) and (orientation:portrait) {
.header_landscape { display: none; }
}
@media only screen and (max-device-width: 1024px) and (orientation:landscape) {
.header_portrait { display: none; }
}
Это часть HTML <head>
:
<meta id="viewport" name="viewport" content="user-scalable=0, width=device-width, height=device-height, initial-scale=0.5, maximum-scale=0.5" />
<meta name="apple-mobile-web-app-capable" content="yes">
Это часть HTML <body>
:
<div class="header_portrait" ontouchmove="togle_touch('disable');">
</div>
<div class="header_landscape" ontouchmove="togle_touch('disable');">
</div>
Если я удалю метатег видового экрана из определения ориентации головы, все будет нормально. Кажется, что область просмотра испортила max-device-width, так что медиа-запрос CSS не обнаруживает ее должным образом.
Любая помощь приветствуется :)