Home > Article > Web Front-end > Why is My Select/Dropdown Background Image Not Working in Chrome?
Background Image for Select/Dropdown Not Working in Chrome
In an attempt to enhance the visual appeal of a web page, you encounter an issue where a background image intended for a select/dropdown element doesn't render in Google Chrome. While the CSS provided below works flawlessly in Firefox and Internet Explorer, it fails to display in Chrome.
<code class="CSS">#main .drop-down-loc { width: 506px; height: 30px; border: none; background-color: Transparent; background: url(images/text-field.gif) no-repeat 0 0; padding: 4px; line-height: 21px; }</code>
Solution:
To resolve this issue in Chrome, you can employ the following CSS code:
<code class="CSS">select { -webkit-appearance: none; }</code>
This CSS property removes Chrome's default styling for select elements, allowing you to apply custom styling, including background images.
Additionally, if you require an arrow as part of the background, you can include an image that incorporates it into the custom background image.
The above is the detailed content of Why is My Select/Dropdown Background Image Not Working in Chrome?. For more information, please follow other related articles on the PHP Chinese website!