需要为每个移动设备扩展一个图像(徽标)的媒体请求:iPhone 5,6,6 +,iPad,以及大屏幕。 因此,我几乎需要以宽度等形式指定样式。用于纵向和横向。 仅适用于iPhone 6,iPad和大屏幕的所有作品(=> 1600px) 对于小屏幕(320x480)和iPhone 6+不起作用(检查Chrome)
对于适用于iPhone 5的iPhone 6+媒体查询......
请告诉我,我的代码中有什么问题? 我将非常感激!
这里是CSS:
@media only screen and (max-width: 320px) and (max-width : 480px) {
.logo-mobile img {
width: 150px;
transform: translateY(-7px);
}
}
@media only screen and (min-width: 321px) and (max-width : 480px) {
.logo-mobile img {
width: 150px;
transform: translateY(-7px);
}
}
@media only screen and (min-width: 320px) and (max-height: 568px) and
(orientation: landscape) and (-webkit-device-pixel-ratio: 2){
.logo-mobile img {
width: 144px;
transform: translateY(-7px);
}
}
@media only screen and (min-width: 320px) and (max-height: 568px) and
(orientation: portrait) and (-webkit-device-pixel-ratio: 2){
.logo-mobile img {
width: 144px;
transform: translateY(-7px);
}
}
@media only screen and (min-width: 375px) and (max-height: 667px) and
(orientation: landscape) and (-webkit-device-pixel-ratio: 2){
.logo-mobile img {
width: 144px;
transform: translateY(-8px);
}
}
@media only screen and (min-width: 375px) and (max-height: 667px) and
(orientation: portrait) and (-webkit-device-pixel-ratio: 2){
.logo-mobile img {
width: 100%;
transform: translateY(-11px);
}
}
@media only screen and (min-width: 414px) and (max-height: 736px) and
(orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
.logo-mobile img {
width: 144px;
transform: translateY(-8px);
}
}
@media only screen and (min-width: 414px) and (max-height: 736px) and
(orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
.logo-mobile img {
width: 144px;
transform: translateY(-8px);
}
}
@media only screen and (min-width: 768px) and (max-width: 1024px) and
(orientation: landscape) and (-webkit-device-pixel-ratio: 2) {
.logo-mobile img {
width: 100%;
transform: translateY(-8px);
}
}
@media only screen and (min-width: 768px) and (max-width: 1024px) and
(orientation: portrait) and (-webkit-device-pixel-ratio: 2) {
.logo-mobile img {
width: 100%;
transform: translateY(5px);
}
@media only screen and (min-width: 1600px) {
.logo-mobile img {`enter code here`
width: 100%;
}
}
答案 0 :(得分:1)
您可以先确保添加元标记
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
您还可以考虑为CSS3选择器添加适当的前缀,例如......
-webkit-transform: translateY(8px)//Chrome
-o-transform: translateY(8px) //Opera
等等。您可以查看w3schools以获取完整的css3前缀列表。我希望这有帮助...