Media queries not work in firefox

2019-09-06 01:10发布

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;
    }
}

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

2条回答
The star\"
2楼-- · 2019-09-06 01:24

Your Code completely Worked.

See Live Demo Here

And Check This Url in Firefox. then Also work. i also try . See Image

enter image description here

Snippet Example

 @media screen and (max-width: 1255px) {
            .visible-desktop{
                display: none;
            }
        }
<div class="visible-desktop">
Hello visible-desktop Class 
</div>

查看更多
你好瞎i
3楼-- · 2019-09-06 01:28

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

As you can see on this JSFiddle...

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;
查看更多
登录 后发表回答