如何在选择选项标签中显示图标 [英] How to display Icon in select options tag

查看:55
本文介绍了如何在选择选项标签中显示图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要在选择选项标签中显示 Font Awesome 吗?

如果我使用外部它的工作 </i>但是如果文本

,我怎么能在标签中显示它

<option value="fa fa-address-card">&#xf2bb;折线图</option><option value="fa fa-address-card">&#xf2bb;饼图</option></选择>

如果这不起作用,请确保这一点

.fa 选项 {字体粗细:900;}

希望对你有帮助.更好的是,我建议您在

Need to display Font Awesome in select options tag?

If i use outside Its working <i class="fas fa-chart-pie"></i> But how can i display it in tag instead if text

<select id="select_graphtype">
  <option value="line_graph"> Line Graph</option>
  <option value="pie_chart"> Pie Chart</option>
</select>

Can you please help me out ?

解决方案

You can't use (icon tag) inside (option tag), but you can do it differently like use class='fa' in select and icon classes in option's value. It's fully working in my case.

<select id="select_graphtype" class="fa">
    <option value="fa fa-address-card"> &#xf2bb; line chart</option>
    <option value="fa fa-address-card"> &#xf2bb; Pie Chart</option>
</select>

If this is not working please ensure this

.fa option {

    font-weight: 900;
}

Hope this helps you. Better I would suggest you dashing frontend framework Materialize CSS select in this link.. I have been using it for my frontend works.

这篇关于如何在选择选项标签中显示图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆