[英]Font awesome Unicode icon is not shown in dropdown list
I have a dropdown to choose Male or Female.我有一个下拉菜单来选择男性或女性。 I want to show male or female icon beside the each option.我想在每个选项旁边显示男性或女性图标。 I would like to use font awesome 5. To show icon I have used the Unicode of male and female icon from font awesome site.我想使用 font awesome 5。为了显示图标,我使用了来自 font awesome 网站的男性和女性图标 Unicode。 But the unicode is not showing.但是 unicode 没有显示。 I have taken help from this link我已从此链接获得帮助
HTML Code: HTML 代码:
<select class="form-control" id="gender" name="gender">
<option value="" selected>Select Gender</option>
<option value="">Male </option>
<option value="">Female </option>
</select>
CSS Code: CSS 代码:
select {
font-family: 'Font Awesome\ 5 Brands' , 'arial'
}
I have already added the font awesome CSS CDN.我已经添加了字体 awesome CSS CDN。
It works for github icon but does not works for Male or Female icon.它适用于 github 图标,但不适用于男性或女性图标。
I have a similar problem before, trying to add-in class in each option the corresponding class of icon我之前也有类似的问题,尝试在每个选项中添加class图标对应的class
<select class="form-control" id="gender" name="gender">
<option value="" selected>Select Gender</option>
<option class="fas fa-male" value="male">Male </option>
<option class="fas fa-female" value="female">Female </option>
</select>
do you add cdn in your code?你在你的代码中添加cdn吗? try this code.试试这个代码。
select { font-family: 'Font Awesome\ 5 Brands', 'arial' }
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> <select> <option selected value="fa fa-github">Github </option> </select> <i class="fab fa-github"> </i>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.