我有这些媒体查询应用不同的样式为iPhone 4和iPhone 5靶向iPhone 4,并与媒体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的样式过于应用。我怎样才能防止这一点?
您好燕,欢迎堆栈溢出。将来,请缩进代码示例,并在编辑器中将它们标记为代码,以便它们可以更容易地语法突出显示和理解。谢谢! – janfoeh
您不应该需要单独的媒体查询来说明不同的垂直视口大小。例如,考虑使用“固定”定位。 – Dai
你能举个例子吗? – Yan