简体   繁体   English

媒体查询在firefox和

[英]Media query works differently in firefox and ie

Ok so my media query is working fine in chrome, but when I try the code in firefox or ie, the margin-top or margin-left are different and not accurate like in chrome !!! 好的,所以我的媒体查询在chrome中可以正常工作,但是当我在Firefox中尝试代码时,即margin-top或margin-left不一样,并且不像chrome一样!

Here's the code I use: 这是我使用的代码:

 @media screen and (max-width:800px) { 
    #box-move {
        margin-left:-20px;
        margin-top:40px; 
    } 
 }

So is there a special tecnique for firefox or ie? 那么,有没有专门针对Firefox的技术?

Thanks. 谢谢。

It's actually not a CSS or CSS interpretation problem at all–it's the way Firefox does (or doesn't) resize the viewport. 实际上,这根本不是CSS或CSS解释问题,而是Firefox调整(或不调整)视口大小的方式。

Unlike Google Chrome, and most other browsers, Firefox allows it's toolbars to affect viewport size. 与Google Chrome和大多数其他浏览器不同,Firefox允许其工具栏影响视口大小。 The only way to make the viewport resize below the width of your toolbars in Firefox is to disable them. 在Firefox中将视口调整为低于工具栏宽度的唯一方法是禁用它们。

You'll need to go to View > Toolbars and uncheck each. 您需要转到视图>工具栏,然后取消选中每个。 Then try resizing and watch your media queries take effect. 然后尝试调整大小并观看您的媒体查询生效。

I hope I explained that right. 我希望我能解释正确。 It's been a trying day! 这是一个艰难的一天!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM