【问题标题】:glyph icon in html select not workinghtml中的字形图标选择不起作用
【发布时间】:2014-10-09 10:26:06
【问题描述】:

我正在尝试从选择中获取一个在类别名称之前显示一个 glyp 图标。类别名称显示正常。我无法显示字形图标。它在选项之外工作,但无法将图标放入下拉菜单。

提前致谢。这是我所在的地方

<option \>Select</option>
  <?php
do {  
?>
  <option value="<?php echo $row_event_cats['cat_id']?>"><i class="fa fa-leaf"></i><?php     echo $row_event_cats['cat_name']?></option>
  <?php
} while ($row_event_cats = mysql_fetch_assoc($event_cats));
  $rows = mysql_num_rows($event_cats);
  if($rows > 0) {
      mysql_data_seek($event_cats, 0);
      $row_event_cats = mysql_fetch_assoc($event_cats);
  }
?>
</select>

【问题讨论】:

    标签: php html font-awesome glyphicons


    【解决方案1】:

    下拉菜单只会显示文本。但是 Glyphicon 标签&lt;i class="fa fa-leaf"&gt;&lt;/i&gt; 不包含文本,因此不会显示。您也许可以尝试找到一个实际上使用字符而不是类的字形库,但我现在想不出任何正确的方法。让我搜索几秒钟。

    编辑

    看来使用“标准”HTML 工具包是不可能的。如果您使用的是 Bootstrap,请查看http://silviomoreto.github.io/bootstrap-select/

    如果不是,请查看http://ivaynberg.github.io/select2/

    【讨论】:

    • 它的值为“UTF+E002”,但我不确定如何实现。
    • 你在使用 Bootstrap 吗?
    • 看来你得看看这个:ivaynberg.github.io/select2 因为用“原生”HTML 做这件事似乎很难。
    • 是的,使用 Bootstrap。我会检查 select2
    • 如果你正在使用 Bootstrap,我认为你最好这样做:silviomoreto.github.io/bootstrap-select 检查示例部分的末尾。
    猜你喜欢
    • 2015-09-02
    • 1970-01-01
    • 1970-01-01
    • 2013-10-16
    • 2017-03-25
    • 2015-07-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多