如何在 Bootstrap 中使用 Glyphicons 图标


要在 Bootstrap 中使用 Glyphicons 图标,在代码中的任意位置使用以下代码。在图标和文本之间留一个空格,以获得适当的填充,例如 −

示例

实时演示

<!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>

你可以尝试运行以下代码来实现 Glyphicons 图标

示例

实时演示

<!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>

更新于:2020-06-12

1K+ 浏览

开启你的职业生涯

获得课程结业证书

开始学习
广告
© . All rights reserved.