【问题标题】:Why Bootstrap 4 Glyphicon not showing [duplicate]为什么Bootstrap 4 Glyphicon不显示[重复]
【发布时间】:2020-01-07 00:40:06
【问题描述】:

我的项目中包含以下引导 CDN

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

我尝试在我的 php 脚本中以以下方式回显字形图标

echo '<div class="col-sm"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>'.$deviceName.'</div>';

但是什么都没有出现。有谁知道为什么?

【问题讨论】:

  • Bootstrap 4 删除了 Glyphicons 图标字体
  • 你至少需要 Bootstrap 3.4.0 这样的字形图标
  • 使用字体真棒图标而不是引导字形图标

标签: php html bootstrap-4 glyphicons


【解决方案1】:

像这样使用 FontAwesome 图标

@import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.css";
      <p>
          <i class="fa fa-spinner fa-spin"></i>
          <i class="fa fa-refresh fa-spin"></i>
          <i class="fa fa-cog fa-spin"></i>
      </p>
      <br>
      <p>
          <i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
          Use a few styles together and you'll have easy pull quotes or a great introductory article icon.
      </p>
      <br>
      <h2>Stacked Icons</h2>
      <p>
          <span class="fa-stack fa-lg">
              <i class="fa fa-square-o fa-stack-2x"></i>
              <i class="fa fa-twitter fa-stack-1x"></i>
      </span>
      fa-twitter on fa-square-o<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-circle fa-stack-2x"></i>
        <i class="fa fa-flag fa-stack-1x fa-inverse"></i>
      </span>
      fa-flag on fa-circle<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-square fa-stack-2x"></i>
        <i class="fa fa-terminal fa-stack-1x fa-inverse"></i>
      </span>
      fa-terminal on fa-square<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-camera fa-stack-1x"></i>
        <i class="fa fa-ban fa-stack-2x text-danger"></i>
      </span>
      fa-ban on fa-camera
      </p>

见代码Code Link

【讨论】:

    【解决方案2】:

    Bootstrap 4 没有自己的图标库,BS4 不支持 Bootstrap 3 中的 Glyphicons。但是,有许多免费的图标库可供选择,例如 Font Awesome 和 Google Material Design Icons。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-20
      • 2017-07-19
      • 2020-12-22
      • 1970-01-01
      • 2015-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多