13

Installing Google Material icons using Setup Method 2 self hosting for our React project the ligatures associated with the icon is sometimes displayed before the material icon.

<i class="material-icons">face</i> {/* shows text "face" on site prior to proper material icon load */}

For example the above line would display "face" for a second before showing a face. How can we delay the UI rendering until the file references are fully loaded?

/*material icons file references loaded locally */
    @font-face {
      font-family: 'Material Icons';
      font-style: normal;
      font-weight: 400;
      src: url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.eot); /* For IE6-8 */
      src: local('Material Icons'), local('MaterialIcons-Regular'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2) format('woff2'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff) format('woff'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf) format('truetype');
    }
sammarcow
  • 2,386
  • 2
  • 23
  • 56

1 Answers1

-1

Answer from How to prevent material icon text from showing up when Google's JS fails to convert them?:

you can use font-display: block;, just add this CSS to your HTML head:

<style>
   @font-face {
      font-family: 'Material Icons';
      font-display: block;
    }
</style>

for more information font-display

mike mckechnie
  • 804
  • 8
  • 14