Syntax error How to use the Glyphicons icons in Bootstrap

How to use the Glyphicons icons in Bootstrap



To use the Glyphicons icon in Bootstrap, use the following code just about anywhere in your code. Leave a space between the icon and text for proper padding like −

Example

Live Demo

<!DOCTYPE html>
<html>
  <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <span class = "glyphicon glyphicon-user"></span>
   </body>
</html>

You can try to run the following code to implement the Glyphicons icons:

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <p>The following are the icons:</p>
      <p>
         <button type = "button" class = "btn btn-default">
            <span class = "glyphicon glyphicon-print"></span>
         </button>
         <button type = "button" class = "btn btn-default">
            <span class = "glyphicon glyphicon-search"></span>
         </button>
         <button type = "button" class = "btn btn-default">
            <span class = "glyphicon glyphicon-download"></span>
         </button>
      </p>
   </body>
</html>
Updated on: 2020-06-12T22:27:06+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements