简体   繁体   中英

Change HTML Select arrow background color

I have a select menu with options

In Firefox, it has an "arrow button" 在此处输入图像描述

In Chrome/Edge, it doesn't

在此处输入图像描述

How do I make it so that the Firefox "expand menu" button looks like Chrome/Edge?

<select>
<option>Example</option>
<option>Example</option>
<option>Example</option>
<option>Example</option>
</select>

Some linear-gradient background-image hacks:

 select { /* styling */ background-color: black; color: white; line-height: 1.5em; padding: 0.5em 3.5em 0.5em 1em; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; -webkit-appearance: none; -moz-appearance: none; } select.classic { background-image: linear-gradient(45deg, transparent 50%, white 50%), linear-gradient(135deg, white 50%, transparent 50%), linear-gradient(to right, black, black); background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px), 100% 0; background-size: 5px 5px, 5px 5px, 2.5em 2.5em; background-repeat: no-repeat; }
 <select class="classic"> <option>Option</option> <option>Option</option> <option>Option</option> </select>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM