Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material Design Icons not showing in browser

I'm trying to host the Google Material Design icon set for my website however I cannot get the icons to show in Chrome or Safari.

I'm using this CSS file:

@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(/public/dist/font/Material-Design-Icons.eot); /* For IE6-8 */
  src: url(/public/dist/font/Material-Design-Icons.woff2) format('woff2'),
       url(/public/dist/font/Material-Design-Icons.woff) format('woff'),
       url(/public/dist/font/Material-Design-Icons.ttf) format('truetype');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;  /* Preferred icon size */
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-transform: none;
  letter-spacing: normal;
  word-wrap: normal;
  white-space: nowrap;
  direction: ltr;

  /* Support for all WebKit browsers. */
  -webkit-font-smoothing: antialiased;
  /* Support for Safari and Chrome. */
  text-rendering: optimizeLegibility;

  /* Support for Firefox. */
  -moz-osx-font-smoothing: grayscale;

  /* Support for IE. */
  font-feature-settings: 'liga';
}

Pulling in the file with:

link(rel="stylesheet", href="/public/dist/css/font.css")

Which I can see in the browser is loaded

The font itself is even loaded into the page, I can see the .woff file in the network tab on Chrome.

This is the public folder structure which is hosted 'as is' by the server

Public folder

I'm using the font here (jade):

i.material-icons.prefix perm_identity

And I can see the CSS class above applied to that element

But the fonts don't render.

EDIT: People here having the same issue: https://github.com/google/material-design-icons/issues/205

like image 974
rcjsdev Avatar asked Jan 19 '16 15:01

rcjsdev


People also ask

How do I use material icons on my website?

Using the Icon Google's Material Icons provides a long list of icons. Choose any one of them and add the name of the icon class to any HTML element within the < body > tag. In the following example, we have used the icon named accessibility that belongs to the action category.

Where can I find material icons?

The complete set of material icons are available on the material icon library. The icons are available for download in SVG or PNGs, formats that are suitable for web, Android, and iOS projects or for inclusion in any designer tools.

How do I add material icons to WordPress?

Get the pluginGo to the admin panel in your WordPress Dashboard and click on Plugins in the sidebar menu. Click on Add New. Search for Material Design. Click Install Now from the search results.

Are material icons open source?

We believe that everyone should have access to quality design resources, so Material Icons are open source and available under the Apache 2.0 license.


1 Answers

This was caused by outdated icon fonts on the materializecss.com website, I used the ones off the Google GH repo and they worked sigh

like image 174
rcjsdev Avatar answered Sep 19 '22 23:09

rcjsdev