When it comes to styling <select>
, you cannot use pseudo-elements
. However, you can apply them to a label
instead.
To hide the default down arrow of the select element, you can utilize the following CSS:
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
This will remove the default down arrow and allow you to use the fa-chevron-circle-down
icon with its unicode \f13a
as an :after
pseudo-element on the label
.
While this may not be the most elegant solution, it gets the job done effectively.
Feel free to give it a try and let me know if it works for you!
Check out the code snippet below for implementation details:
label.wrap {
width:200px;
overflow: hidden;
height: 50px;
position: relative;
display: block;
border:2px solid blue;
}
select.dropdown{
height: 50px;
padding: 10px;
border: 0;
font-size: 15px;
width: 200px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
label.wrap:after {
content:"\f13a ";
font-family: FontAwesome;
color: #000;
position: absolute;
right: 0;
top: 18px;
z-index: 1;
width: 10%;
height: 100%;
pointer-events: none;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"/>
<label class="wrap">
<select class="dropdown">
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
</label>