Media Queries firing at wrong width
A common reason this happens is if you have zoomed the browser window to a size other than 100%. In your browser, select the drop-down menu 'View' and make sure it is set to 100%. If you are zoomed in or out, it will trigger media-queries inappropriately.
And don't worry about feeling embarrassed. It has probably happened, or will happen to everyone.. but only once.
In order to avoid this issue all together, you should considering defining your media queries using a relative units (em
or rem
rather than px
).
You can also enforce setting the browser zoom level to 100% on page load using javascript.
document.body.style.webkitTransform = 'scale(1)';
document.body.style.msTransform = 'scale(100)';
document.body.style.transform = 'scale(1)';
document.body.style.zoom = screen.logicalXDPI / screen.deviceXDPI;
Just a short addition, to prevent others from searching further even though the answer is given here.
My zoom was already set to 100%, and still the issue was there. If you experience the same, the answer is simple: set your zoom to 90% and back to 100%, et voila, breakpoints on the width you want 'm.
Another addition. After an hour of debugging I realized I had coded multiple media queries and because css files are executed from top to bottom, I was overriding previous media query logic. Ex:
@media (max-width: 700px) {
.some-class { background-color: red; }
};
// This will override the above styling (assuming max-width logic is true)
@media (max-width: 800px) {
.some-class { background-color: yellow; }
};