skip to Main Content

PROBLEM

The <a> tag on which I have applied a font-icon from fontello.com renders like this on the web page, though it is supposed to be this left or right arrow:

enter image description here

BACKGROUND

I used the first four points from this answer as a tutorial to use a font from fontello.com. I don’t fully understand the 5th point (the <i> tag part) but it is optional as well.

……..

I need a standalone (i.e. Not with text) glyph icon on an <a> element, 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 <a> element:

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

………

Here is the arrows.css file from the CSS folder 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 have created a little demo project (I don’t know how to add fontello in 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 same as above

…………..

enter image description here

2

Answers


  1. Try

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

    The 5th step refers only to applying zero margin to your icons.


    EDIT:

    Keep your <a> elements as you have them now, no need to edit.

    Edit paths in arrows.css file and remove ../ from the beginning of 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;
    }
    
    Login or Signup to reply.
  2. cause you are using the free "demo" fonts, and thus have to add the "demo-icon" class to every class you add each icon.
    Example:

    <i class="demo-icon left-arrow icon-angle-left"></i>

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search