Skip to content

Instantly share code, notes, and snippets.

@dominykas
Created March 18, 2013 08:08
Show Gist options
  • Save dominykas/5185699 to your computer and use it in GitHub Desktop.
Save dominykas/5185699 to your computer and use it in GitHub Desktop.
Firefox has a bug with zoom and media queries

Test case files:

  • container.html: IFRAME, 720px wide
  • mq.html should display:
    • 'Matching: default', when screen is <719px wide
    • 'Matching: min-width:719px', when screen is =719px wide
    • 'Matching: min-width:720px', when screen is >719px wide

In Firefox:

  • just mq.html works as expected (I think... too hard to repro exact circumstances)
  • container.html works as expected at 100% zoom
  • BUG: mq.html inside container.html may think it is only 719px wide when zoomed in (differs based on zoom level)
<!doctype html>
<html>
<head>
<title>Firefox MQ test (container)</title>
</head>
<body>
<iframe width="720" height="480" id="mqContainer" src="mq.html"></iframe>
</body>
</html>
<!doctype html>
<html>
<head>
<title>Firefox MQ test</title>
<style>
#mq:after {
content:"default";
}
@media screen and (min-width: 719px) {
#mq:after {
content: "min-width: 719px";
}
}
@media screen and (min-width: 720px) {
#mq:after {
content: "min-width: 720px";
}
}
</style>
</head>
<body>
<p id="mq">Matching:</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment