select 태그 화살표 커스터마이징
1. html 작성
<fieldset class="form--fieldset">
<div class="form--selectArea">
<select name="category" form="myForm">
<option value="" selected>전체</option>
<option value="">테스트1</option>
<option value="">테스트2</option>
<option value="">테스트3</option>
</select>
<svg role="presentation" class="icon--arrow" width="40" height="40" viewBox="0 0 40 40" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M24 17H15L19.6957 23L24 17Z" fill="#767676" />
</svg>
</div>
</fieldset>
2. select 태그 내 화살표 없애기
select::-ms-expand {
display: none;
}
select {
-o-appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
1. svg영역까지 selcet태그 영역 넓히기 + pointer
fieldset {
position: relative;
display: flex;
padding: 0;
margin: 0;
border: 0;
width: 135px;
}
.icon--arrow {
position: absolute;
right: 0;
bottom: 0;
display: block;
padding: 0;
}
.form--selectArea select {
z-index: 2;
position: relative;
background-color: transparent;
border-color: none;
border: none;
box-shadow: none;
width: 135px;
height: 40px;
cursor: pointer;
outline: none;
}
참고자료
Select box with inline SVG arrow