【问题标题】:Bootstrap 3 glyphicon not working inside a buttonBootstrap 3 glyphicon 在按钮内不起作用
【发布时间】:2017-01-30 22:19:51
【问题描述】:

我对 Bootstrap Glyphicons 有一个奇怪的问题。我无法让 glyphicon glyphicon-option-horizontalglyphicon glyphicon-option-vertical 在这样的按钮内工作:

<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  <span class="glyphicon glyphicon-option-horizontal"></span>
</button>

如果我尝试使用例如glyphicon glyphicon-plus,它和其他字形也可以使用。这可能是什么问题?

我正在使用 Bootstrap v3.0.3。而且我无法更改 Bootstrap 版本。我尝试输入display:inline-block,但没有成功。

【问题讨论】:

  • 你使用什么引导版本?
  • 如果您无法更改您使用的 Bootstrap 版本,只需将 display:inline-block 放在 glyphicon 类上即可。
  • glyphicon glyphicon-option-horizo​​ntal 和 glyphicon glyphicon-option-vertical 在 bootstrap V3.0.3 中不可用
  • @MostafaBaezid 我可以以某种方式手动添加它们吗?我需要它们。
  • @Doadc 如果您需要这个紧急基础,请按照 Lalji Tadhani Bootstrap 版本 3.0.0 [jsfiddle.net/1wr0gf9e/1] 给出的答案添加核心 css 版本 3.0.3 并添加最小值。 css 版本 3.3.7 但我不知道这是否会在不久的将来造成任何困难

标签: html css twitter-bootstrap twitter-bootstrap-3


【解决方案1】:

添加最新的bootstrap css version 3.3.7 正在工作

<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  <span class="glyphicon glyphicon-option-horizontal"></span>
</button>
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
  <span class="glyphicon glyphicon-option-vertical"></span>
</button>

https://jsfiddle.net/1wr0gf9e/

引导版本3.0.0

https://jsfiddle.net/1wr0gf9e/1/

【讨论】:

  • 如果我们使用 min.css 3.3.7 和 css 3.0.3 对我们近期的项目没有影响?
【解决方案2】:

字形图标必须设置为&lt;i&gt; 标签(在“所有”版本的引导程序中)

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script   src="https://code.jquery.com/jquery-3.1.0.min.js"   integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="   crossorigin="anonymous"></script>
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>



<button class="btn btn-default">
  <i class="glyphicon glyphicon-option-horizontal"></i>
</button>

【讨论】:

    猜你喜欢
    • 2014-12-17
    • 1970-01-01
    • 1970-01-01
    • 2016-12-13
    • 2015-07-07
    • 1970-01-01
    • 2015-01-11
    • 2016-09-16
    相关资源
    最近更新 更多