Как добавить свою svg стрелку в select
<label for="pet-select">Choose a pet:</label>
<select name="pets" id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="goldfish">Goldfish</option>
</select>
Как изменить стрелку селекта на свою
Ответы (2 шт):
Автор решения: soledar10
→ Ссылка
Пример
*,
*:before,
*:after {
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
body {
padding: 4em;
}
.select {
height: 40px;
width: 100%;
overflow: hidden;
position: relative;
border-radius: 3px;
margin-bottom: 1em;
}
.select:after {
content: "▼";
padding: 12px 8px;
position: absolute;
right: 0px;
top: 0;
z-index: 1;
text-align: center;
width: 10%;
height: 100%;
pointer-events: none;
}
.select__field {
height: 40px;
width: 100%;
padding: 5px 15px;
color: #616263;
background-color: #ececec;
border: 1px solid #e3e3e3;
outline: none;
font-size: 16px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.select__field::-ms-expand {
display: none;
}
.select__field:focus:invalid {
border-color: #FD6347;
}
.select__field:required:valid {
border-color: #006400;
}
<div class="select">
<select name="nameValueSelect" class="select__field" name="pets" id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="goldfish">Goldfish</option>
</select>
</div>
Автор решения: Проста Miha
→ Ссылка
select{
-moz-appearance:none; /* Firefox */
-webkit-appearance:none; /* Safari and Chrome */
appearance:none;
background-image: url("https://cdn-icons-png.flaticon.com/512/6879/6879387.png");
background-size: contain;
background-repeat: no-repeat;
background-position: right;
padding: 6px 24px 6px 0;
}
<label for="pet-select">Choose a pet:</label>
<select name="pets" id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="goldfish">Goldfish</option>
</select>