Doepud Web Design

Smart Websites for Small Businesses

Technical

Microsoft Edge @font-face not displaying all fonts

After painstakingly working through every scenario possible, we eventually worked out why Microsoft Edge wasn't displaying some fonts correctly

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

Popular articles

More Articles

We have high standards

Not just those we set ourselves but those recommended by the World Wide Web Consortium (W3C); in particular the Web Content Accessibility Guidelines (WCAG).

Like to work with us?

We're a tiny web design business based in the Highlands of Scotland, focused on crafting the finest websites. We've been doing this for a long time too.

Speak to us for free and impartial advice. Drop us a line on 0776 1100 661, we love talking about websites.

Working the web since 2003