At Doepud we rarely find annoying bugs with browsers these days, partly because we like to keep our CSS and JavaScript simple, but mainly because browser vendors do a great job sticking to standards and delivering a consistent experience across a wide range of devices. It was a surprise then to find, when showing a client a demo version of their new site, and on a web browser that we normally consider to be pretty decent (Microsoft Edge) a very unusual bug feature. The issue was related to @font-face, or more specifically @import, with the main headings not displaying the embedded font as expected.
Firefox and Chrome ok... but not Edge
Everything was working fine in Firefox and Chrome but not Microsoft's Edge browser (as it happened, we also found the issue extended to Internet Explorer 11).
Media Queries
Turns out that within our CSS file, when requesting fonts (using @import) inside a media query, like this:
@charset "utf-8";@media screen { //imports @import 'normalise'; @import 'fonts'; ...
...Microsoft Edge (and IE11 let's not forget) opted to ignore them entirely. So, moving the @import rule up and outside the @media screen resolved the issue:
@charset "utf-8"; @import 'fonts';@media screen { //imports @import 'normalise'; ...
Some things never change eh? Microsoft have always liked to do things their own way.
Last updated: 13 Jun 2021