0

是否有一些使用媒体查询的新标准。或者我应该说,应该做出一些新的考虑。

CSS 技巧文章似乎效果不佳,因为“智能手机领域”似乎劫持了一切。

我直接使用的代码(除了打印屏幕应该是什么:

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
.size:after{ content: "smartphone portrait and landscape";}
body{background-color:#111; color:#fff;}
}

/* Smartphones (landscape) ----------- */
@media only screen 
and (min-width : 321px) {
.size:after{ content: "smartphone landscape";}
body{background-color:#222; color:#fff;}
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
.size:after{ content: "smartphones portrait";}
body{background-color:#333; color:#fff;}
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
.size:after{ content: "ipad protrait and landscape";}
body{background-color:#444; color:#fff;}
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
.size:after{ content: "ipad landscape";}
body{background-color:#555; color:#fff;}
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
.size:after{ content: "iPads portrait";}
body{background-color:#666; color:#000;}
}

/* Desktops and laptops ----------- */
@media only screen 
and (min-width : 1224px) {
.size:after{ content: "desktops and laptops";}
body{background-color:#777; color:#000;}
}

/* Large screens ----------- */
@media only screen 
and (min-width : 1824px) {
.size:after{ content: "largscreens";}
body{background-color:#888; color:#000;}
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
.size:after{ content: "iPhone 4";}
body{background-color:#999; color:#000;}
}

测试:www2.iscotest.com/screen.php

是否只有宽屏、桌面 (1024)、ipad 横向、ipad 纵向、移动纵向和移动横向的工作标准集。

谢谢!

4

2 回答 2

1

您的链接未显示,您是否添加了 css 元信息?

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
于 2012-10-31T20:00:22.657 回答
1

只需使用 min-width 和 max-width

于 2012-10-31T20:22:18.733 回答