Search code examples
htmlcssimagefontastic

Fontasic images not showing in the webpage


a beginner here. I am trying to use Fontastic for a website. Here is how I am using it:

<html>
<head>
    <link href="https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/icons.css" rel="stylesheet">
</head>
<body>
    <h1>
        <i class="icon-code">a</i> My Title
    </h1>
</body>
</html>

How ever the result I get appears like this:

aMy Title

While it is supposed to show a tiny image. I appreciate any comment, suggestion and code sample.


Solution

  • Look at the contents of your css file. The only icons referenced are .icon-alignment-aligned-to and icon-briefcase. icon-code does not exist.

    icons.css

    @charset "UTF-8";
    
    /* untitled-font-1 */
    @font-face {
      font-family: "untitled-font-1";
      src:url("https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/fonts/1417862732.eot");
      src:url("https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/fonts/1417862732.eot?#iefix") format("embedded-opentype"),
        url("https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/fonts/1417862732.woff") format("woff"),
        url("https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/fonts/1417862732.ttf") format("truetype"),
        url("https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/fonts/1417862732.svg#1417862732") format("svg");
      font-weight: normal;
      font-style: normal;
    }
    
    [data-icon]:before {
      font-family: "untitled-font-1" !important;
      content: attr(data-icon);
      font-style: normal !important;
      font-weight: normal !important;
      font-variant: normal !important;
      text-transform: none !important;
      speak: none;
      line-height: 1;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
    
    [class^="icon-"]:before,
    [class*=" icon-"]:before {
      font-family: "untitled-font-1" !important;
      font-style: normal !important;
      font-weight: normal !important;
      font-variant: normal !important;
      text-transform: none !important;
      speak: none;
      line-height: 1;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }
    
    .icon-alignment-aligned-to:before {
      content: "a";
    }
    .icon-briefcase:before {
      content: "b";
    }
    

    <link href="https://fontastic.s3.amazonaws.com/3BksDdMDDYiXnZWaHMVHCd/icons.css" rel="stylesheet"/>
    
    <h1>
            <i class="icon-briefcase"></i> My Title
        </h1>
    <h1>
            <i class="icon-alignment-aligned-to"></i> My Title
        </h1>