媒体查询在Firefox中不起作用 [英] Media queries not work in firefox

查看:124
本文介绍了媒体查询在Firefox中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的php项目添加了以下媒体查询,以在屏幕宽度为1254px时隐藏图像.

I have added following media query for my php project to hide an image when screen width is 1254px.

@media screen and (max-width: 1255px ) {
    .visible-desktop {
        display: none;
    }
}

它可以在Chrome上正常运行,但不能在Firefox上运行.谁能帮我解决这个问题?

It works on Chrome correctly but it's not working on Firefox. Can anyone help me to solve this problem?

推荐答案

您的媒体查询正确无误,并且可以在chrome和firefox中完美运行.

Your media query is right and working perfectly in chrome and in firefox.

您可以在此JSFiddle上看到...

我猜(因为我们没有更多的代码了).visible-desktop的显示被设置在其他位置上,您无法用它覆盖它.您可以尝试使用!important,这不是一种美的方法,但是可以在大多数情况下(但并非每次都可以)对其进行修复.

I guess (since we dont have any more code) .visible-desktop's display is being setted on some other position where you cant override it with your none. You could try using !important, which is not a beauty way, but can fix it in most times, but also not everytime.

display: none !important;

这篇关于媒体查询在Firefox中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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