Why is this font icon from fontello showing as an empty box?

PROBLEM

The tag <a>

I have applied the font icon from fontello.com looks like this on the web page , although it is assumed to be a left or right arrow

enter image description here

BACKGROUND

I used the first four dots from this answer as a tutorial on using the font from fontello.com . I don't fully understand the fifth point (tag <i>

), but it is also optional.

........

I need a separate icon (i.e. not with text) for the glyph in the element <a>

, so I did this:

<a href="" class="left-arrow icon-angle-left"></a>

      

and

<a href="" class="right-arrow icon-angle-right"></a>

      

and in the CSS for this element <a>

:

.right-arrow, .left-arrow {
    font-family: 'arrows';
    ...
}

      

.........

Here is the file arrows.css

from the folder CSS

downloaded from fontello.com:

@font-face {
  font-family: 'arrows';
  src: url('../font/arrows.eot?42097229');
  src: url('../font/arrows.eot?42097229#iefix') format('embedded-opentype'),
       url('../font/arrows.woff?42097229') format('woff'),
       url('../font/arrows.ttf?42097229') format('truetype'),
       url('../font/arrows.svg?42097229#arrows') format('svg');
  font-weight: normal;
  font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
  @font-face {
    font-family: 'arrows';
    src: url('../font/arrows.svg?42097229#arrows') format('svg');
  }
}
*/

 [class^="icon-"]:before, [class*=" icon-"]:before {
  font-family: "arrows";
  font-style: normal;
  font-weight: normal;
  speak: none;

  display: inline-block;
  text-decoration: inherit;
  width: 1em;
  margin-right: .2em;
  text-align: center;
  /* opacity: .8; */

  /* For safety - reset parent styles, that can break glyph codes*/
  font-variant: normal;
  text-transform: none;

  /* fix buttons height, for twitter bootstrap */
  line-height: 1em;

  /* Animation center compensation - margins should be symmetric */
  /* remove if not needed */
  margin-left: .2em;

  /* you can be more comfortable with increased icons size */
  /* font-size: 120%; */

  /* Font smoothing. That was taken from TWBS */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Uncomment for 3D effect */
  /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}

.icon-angle-right:before { content: '\e800'; } /* 'ξ €' */
.icon-angle-left:before { content: '\e801'; } /* '' */

      


EDIT @Pauli_D

Yes, I have them there. I created a small demo project (I don't know how to add fontello to the JSFiddle, so posting the code here):

index.php:

<?php  

echo '<!DOCTYPE html>
<html>
    <head>      
        <meta charset="utf-8"/>
        <title>Test for Glyph Icon from Fontello</title>
        <link rel="stylesheet" type="text/css" href="style.css"/>
        <link rel="stylesheet" type="text/css" href="arrows.css"/>
    </head>
    <body>';

        echo '<a href="" class="right-arrow icon-angle-right"></a>';

        echo '<br><br><br>';

        echo '<a href="" class="left-arrow icon-angle-left"></a>';

    echo '</body>
    </html>';

?>

      

style.css

.right-arrow, .left-arrow {
    font-family: 'arrows';
    color: #313131;
    text-align: center;
    text-decoration: none;
    width: 40px;
    font-size: 40px;
    padding-bottom: 60px;
    padding-top: 20px;
    filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
    opacity: 0.6;
    -webkit-transition: opacity 0.3s ease;
    -moz-transition: opacity 0.3s ease;
    -o-transition: opacity 0.3s ease;
    transition: opacity 0.3s ease;
}

      

arrows.css is the same as above

..............

enter image description here

+3


source to share


1 answer


Try

<a href=""><i class="left-arrow icon-angle-left"></i></a>
<a href=""><i class="right-arrow icon-angle-right"></i></a>

      

The fifth step only applies to applying a null margin to your icons.




EDIT:

Keep your elements the <a>

way you do them now, no need to edit.

Modify the paths in the arrows.css file and remove ../

from the beginning of the paths.

@font-face {
font-family: 'arrows';
src: url('font/arrows.eot?42097229');
src: url('font/arrows.eot?42097229#iefix') format('embedded-opentype'),
     url('font/arrows.woff?42097229') format('woff'),
     url('font/arrows.ttf?42097229') format('truetype'),
     url('font/arrows.svg?42097229#arrows') format('svg');
font-weight: normal;
font-style: normal;
}

      

+1


source







All Articles