为什么我的CSS媒体查询被忽略? [英] Why is my CSS media query being ignored?

查看:323
本文介绍了为什么我的CSS媒体查询被忽略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让我的ipad这个CSS工作,但似乎是忽略媒体查询和使用默认包装CSS。有没有办法阻止这种情况发生?

Im trying to get this piece of CSS working on my ipad but it seems to be ignoring the media query and using the default wrapper CSS instead. is there a way I can stop this from happening?

@media only screen and (max-width: 1024px) and (max-height: 768px) {
    #wrapper {
        position:absolute; 
        z-index:1;
        top:41px;
        width:150px;
        height:300px;
    }    
}

#wrapper {
    position:absolute; 
    z-index:1;
    top:41px; 
    bottom:0px; 
    left:0;
    width:100%;
    height:800px;
    overflow:auto;
}


推荐答案

样式被后面的值覆盖而不是被忽略?你试过移动一般样式之前的MQ(我想你也可以使用!important,但这通常是一个坏主意),或者添加另一个明显的风格,如 background:red; 在MQ中?

Aren't your media query styles being overridden by the later values rather than ignored? Have you tried moving the general styles before the MQ ones (I suppose you could also use !important, but that's generally a bad idea), or adding in another obvious style, like background: red; in the MQ one?

这篇关于为什么我的CSS媒体查询被忽略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆