I am having problem with css media query in Firefox. It works correct in Chrome like I made two DIVs and want a scrollbar. If I decrease the screen size of firefox upto 800px then both DIVs collapse and after some pixels media query works but that not happens in Chrome.
check this fiddle http://jsfiddle.net/RMvqC/2/
The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.
Scrollbar not included in media query width As noted in the older article I linked to, desktop versions of Chrome, Safari, and other WebKit-based browsers do not include the vertical scrollbar in media query widths.
Media Query Not Working on Mobile Devices If media queries work on desktop and not on mobile devices, then you most likely haven't set the viewport and default zoom. Note: You only need to add one of the code lines above, and usually, the first one does the job.
To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML.
I SOLVED this issue by calling the "mqGenie" javascript in the head of my project.
Now the widths of my media queries work fine ( with the same value ) on Chrome, Safari, Firefox and IE with or without scroolbars.
This javascript Adjusts CSS media queries in browsers that include the scrollbar width in the viewport width so they fire at the intended size.
You can download it from this url:
http://stowball.github.io/mqGenie/
Firefox & Webkit based browsers render the scrollbar differently. In Firefox, MediaQuery considered width of scrollbar which is 15px with the screen width, but in Webkit based browsers it's not considered scrollbar with the screen width. So, that's why the floated DIVs are collapsed in Firefox.
I did some stuff with css may be that's help you. (check this fiddle)
html { /* force scrollbars */ height: 101%; } body { margin: 0; padding:0; white-space:nowrap; } #box1, #box2 { display:inline-block; width: 400px; height: 200px; vertical-align:top; white-space:normal; } #box1 { background: #ce0000; margin-right:-5px; } #box2 { background: #8e0000; } @media screen and (max-width: 799px) { body { white-space:normal; } #box1, #box2 { width: 300px; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With