2

I'm trying to show the fontawesome icons in a select, but in the drop-down list the icons are not previewed well

.FontAwesomeSelect {
    font-family: Font Awesome\ 5 Free;
    font-size: 18px;
}
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet"/>

<select name="sample" id="sample" class="FontAwesomeSelect">
  <option value="">----</option>
  <option value="fa fa-address-card">&#xf2bb;</option>
  <option value="fa fa-bell">&#xf0f3;</option>
  <option value="fa fa-bookmark">&#xf02e;</option>
  <option value="fa fa-building">&#xf1ad;</option>
</select>

Result:

Pablogrind
  • 447
  • 5
  • 9
  • 21

3 Answers3

3

You don't need the FontAwesomeSelect class. Instead, use the default fa class.

<select name="sample" id="sample" class="fa">
        <option value="">----</option>
        <option value="fa fa-address-card">&#xf2bb;</option>
        <option value="fa fa-bell">&#xf0f3;</option>
        <option value="fa fa-bookmark">&#xf02e;</option>
        <option value="fa fa-building">&#xf1ad;</option>
</select>

Fiddle : https://jsfiddle.net/JonathanParentLevesque/uwe8azo7/4/

Demo font-awesome 5 in a drop down list

Notice well what contains this class:

Font-awesome CSS from Google Chrome console

If it's still not working, try this:

.fa option {

    font-weight: 900;
}
  • @Cris There are some known issues with IOS and OSX. You might want to check existing issues and create a new ticket if none solves your problem. https://github.com/FortAwesome/Font-Awesome/issues – Jonathan Parent Lévesque Aug 21 '19 at 15:36
0

using the previous example i did this

<select name="sample" id="sample" class="fa">
    <option value="">----</option>
    <option value="fa fa-address-card">&#xf2bb;</option>
    <option value="fa fa-bell">&#xf0f3;</option>
    <option value="fa fa-bookmark">&#xf02e;</option>
    <option value="fa fa-building">&#xf1ad;</option>

And add this custom css

select.form-control.fa option{ font-weight: 900; }

working with font awesome 5.6.3

-1
<style>
    .fa option {
    font-weight: 900;
    }
</style>

Then the options can look like this:

<option class="fa" value="select_value">&#xf0f3; Name Of Select</option>
Brennan James
  • 332
  • 2
  • 7