使用媒体查询,我为不同的像素计数屏幕创建了不同的视图。但是现在在高像素数的小屏幕上(比如iPhone5、S3、S4),桌面视图已经显示出来了。
如何在这些高清屏幕手机上显示小屏幕视图,即520px 视图?
一些元标记或任何可以提供帮助的html都受到欢迎。
发布于 2014-02-12 07:35:39
<header>
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
</header>css
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-width : 320px)
and (max-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-width : 768px)
and (max-width : 1024px) {
/* Styles */
}
/* iPads (landscape) ----------- */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : landscape) {
/* Styles */
}
/* iPads (portrait) ----------- */
@media only screen
and (min-width : 768px)
and (max-width : 1024px)
and (orientation : portrait) {
/* Styles */
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}发布于 2014-02-12 07:32:04
尝试在HTML文件的顶部添加这两行代码。
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />https://stackoverflow.com/questions/21721193
复制相似问题