Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use Bootstrap Glyphicons in 3.0.0?

I'm using Glyphicons in Bootstrap. I was calling in the CSS straight from http://glyphicons.getbootstrap.com/css/bootstrap-glyphicons.css but this has now disappeared and was not recommended.

This apparently coincides with Twitter making the Glyphicons available in the Bootstrap package again. I am using Bootstrap 3.0.0 RC1 or RC2.

My problem: I have no idea how to use the icons in my own hosting... Seems to me the code is contained within the bootstrap.css (?). I have uploaded the "fonts" directory but am only getting blank, empty-box icons where there should be proper icons.

Any ideas please? What should be where and how should it be called?

like image 214
Robert Andrews Avatar asked Aug 19 '13 09:08

Robert Andrews


People also ask

How do I add Glyphicons in Bootstrap 3?

Bootstrap 3 Glyphicons are actually fonts, so you can scale them and color them as you please. Bootstrap previously used image sprites for icons. To add a glyphicon, add a <span> tag with Bootstrap's . glyphicon class and also the class for the specific glyphicon that you require.

Can I use Glyphicons in bootstrap 4?

Bootstrap 4 does not have its own icon library (Glyphicons from Bootstrap 3 are not supported in BS4). However, there are many free icon libraries to choose from, such as Font Awesome and Google Material Design Icons.

How do I use Glyphicons in bootstrap 5?

In lines 15 and 17 the <span> and <a> element has the bootstrap glyphicon glyphicon-pencil classes, so to use any glyphicon in bootstrap: Use the <span> or <a> element. Set the class attribute of the <span> or <a> element as glyphicon then a space and then glyphicon-iconname.


2 Answers

The bootstrap-glyphicons.css file seems to have been removed with the final\production Bootstrap 3.0.0. Simply download the zip from http://getbootstrap.com/ and then copy the dist/css/bootstrap.min.css file in your css folder. You should then include it in your HTML page as such:

<!DOCTYPE html>
<html>
  <head>
    <title>Bootstrap 101 Glyphicons</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Bootstrap CSS file -->
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">

  </head>
  <body>

    <!-- Glyphicon in a H1 tag -->
    <h1>Hello, <span class="glyphicon glyphicon-globe"></span> !</h1>

  </body>
</html>

Source: http://getbootstrap.com/getting-started/

like image 167
David Lemayian Avatar answered Oct 28 '22 13:10

David Lemayian


If you have already put in the fonts directory, calling the icons now would be <span class="glyphicon glyphicon-pencil"></span> instead of <i class="icon-large icon-pencil"></i>.

like image 20
mrkre Avatar answered Oct 28 '22 12:10

mrkre