I can’t use bootstrap glyphicons

Asked

Viewed 2,700 times

1

I am not able to use the bootstrap glyphicons, just do not appear, I am using a linux machine, and I know it is something related to fonts folder because it did not come in the common bootstrap installation, follows code:

<form>

            <div class="input-group">
                <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                <input id="username" type="text" class="form-control" name="username" placeholder="Usuario">
            </div>
            <div class="input-group">
                <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                <input id="password" type="password" class="form-control" name="password" placeholder="Senha">
            </div>

        </form>

I know my folders will be well disorganized, and that probably the font file was put in the wrong place, I put it everywhere else nothing, I downloaded the fonts file from this link: https://gitlab.com/mailman/mailman-website/tree/a97d6b4c5b29594004e3855f1ab1222449d0c211/content/fonts

inserir a descrição da imagem aqui

Since I’m using SASS for the first time, I made some changes to the _variables.scss class and created a _glyphicons.scss and after these changes, I already got a return, but it’s not the same as if I was using CDN because it aligns right, but I would like to use the css files I downloaded and so I don’t want to use via CDN inserir a descrição da imagem aqui

It can be seen that the icons are a little misaligned with the input, what using CDN it aligns properly nor I need to insert any more lines of code.

  • 1

    Eduardo seems that the tip to import the Font has already given a result right. And it seems that he is already importing some styles of Bootstrap. Are you using Version 3.3 correct? From your code it seems that the Error is now with the form you built the Form or some class you customised wrong or did not use in the correct place and no longer with Glyficon. Avoid editing the question to ask another question. Finish or Accept this question and open a New Question with the other problem. Tmj

  • Thank you Hugo ! I will check my html form code and if I made any impact modifications on css classes and I will also follow your advice on avoiding editing to carry out new questions, vlw.

1 answer

2


Face only the Glyficon font by itself does nothing, you have to import in the Head her CSS too!

Use the official CDN

Now if you want to use locally you have to import the @font-face in your CSS this way for example:

@font-face{
    font-family:'Glyphicons Halflings';
    src:url(../fonts/glyphicons-halflings-regular.eot);
    src:url(../fonts/glyphicons-halflings-regular.woff2);
    src:url(../fonts/glyphicons-halflings-regular.woff);
}

See Example with CDN, fonts usually appear with your code.

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<form>
            <div class="input-group">
                <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                <input id="username" type="text" class="form-control" name="username" placeholder="Usuario">
            </div>
            <div class="input-group">
                <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                <input id="password" type="password" class="form-control" name="password" placeholder="Senha">
            </div>

</form>

That answer can also help you. https://stackoverflow.com/questions/19608873/how-to-include-glyphicons-in-bootstrap-3

  • if I use CDN I lose the settings I’ve already made in the files, I don’t know if it’s very important but I’m using SASS for the first time and so I’m even more lost, I searched on github something about it and found on this link https://github.com/twbs/bootstrap-Sass some data, then copied the _gluphicons.scss variable to the scss folder, added the same Imports is in the link above in _variables.scss and also your example in style.css, SASS compiled without errors and the result is in editing the question

Browser other questions tagged

You are not signed in. Login or sign up in order to post.