【发布时间】:2014-01-10 05:10:14
【问题描述】:
我有这些媒体查询来为 iPhone 4 和 iPhone 5 应用不同的样式
/* iPhone 4 (landscape) */
@media only screen and (min-width:320px) and (max-width:480px) and (orientation:landscape) {
.background img {
height: 5px;
}
}
/* iPhone 4 (portrait) */
@media only screen and (min-width:320px) and (max-width:480px) and (orientation:portrait) {
.background img {
height: 10px;
}
}
/* iPhone 5 (landscape) */
@media only screen and (min-width:320px) and (max-width:568px) and (orientation:landscape) {
.background img {
height: 245px;
}
.logo img {
height: 205px;
width: 205px;
}
}
/* iPhone 5 (portrait) */
@media only screen and (min-width:320px) and (max-width:568px) and (orientation:portrait) {
.background img {
height: 210px;
}
.logo img {
height: 170px;
width: 170px;
}
.top-content h2 {
font-size: 1.8em;
line-height: 120%;
margin-bottom: 20px;
}
.main-container {
margin-top: 30px;
margin-left: 15px;
margin-right: 15px;
}
}
问题是在 iPhone 5 上,也应用了 iPhone 4 的样式。我怎样才能防止这种情况发生?
【问题讨论】:
-
你好严,欢迎来到 Stack Overflow。以后请在编辑器中将代码示例缩进并标记为代码,以便语法高亮和更容易理解。谢谢!
-
您不应该需要单独的媒体查询来说明不同的垂直视口大小。例如,考虑使用
fixed定位。 -
你能举个例子吗?
标签: css twitter-bootstrap media-queries