๋ฐ์ํ
Intro
์๋ ํ์ธ์. select element ์์ dropdown icon ๋ฐ๊พธ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค :)
How to solve problem
<select class="custom-select">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
/* Hide the default dropdown arrow */
.custom-select {
appearance: none; /* For Firefox */
-webkit-appearance: none; /* For Chrome, Safari, Opera */
-moz-appearance: none; /* For Firefox */
background-image: url('custom-dropdown-icon.png'); /* Custom arrow icon */
background-position: right center;
background-repeat: no-repeat;
padding-right: 20px; /* Adjust according to your icon's width */
}
/* Style the dropdown icon */
.custom-select::-ms-expand {
display: none; /* For IE 11 */
}
- appearance: none;, webkit-appearance: none;, moz-appearance: none ์์ฑ์ ์ฌ์ฉํด์ default dropdown arrow๋ฅผ ์จ๊ฒจ์ค๋๋ค.
- background-image ์์ฑ์ ํตํด ์ปค์คํ ํ๊ณ ์ ํ๋ icon์ ๋ฃ์ด์ค๋๋ค.
- background-position, background-repeat, padding-right ์ ์ฌ์ฉํ์ฌ arrow icon ์์น๋ฅผ ์กฐ์ ํด์ค๋๋ค.
- IE11 ๋ธ๋ผ์ฐ์ ์์ ::-ms-expand ๋ฅผ ์ฌ์ฉํ์ฌ default arrow๋ฅผ ์จ๊น๋๋ค.
๋ฐ์ํ