Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background Image for Select (dropdown) does not work in Chrome

I want to use an image for the background of a select/dropdown. The following CSS works fine in Firefox and IE, but does not in Chrome:

#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;} 
like image 637
Ashish Avatar asked Feb 09 '10 04:02

Ashish


People also ask

How can I insert images to select dropdown options?

Add <img> tag in dropdown content to insert image into dropdown list for each items.

Does Chrome support background?

Choose a background themeChoose a background image that appears when you open a new tab. Settings. to open the Chrome Web Store. On the left, click Themes and select a theme.

How do you fix a background image for a website?

Set a background image using the HTML body elementAdd the bgproperties="fixed" code into the body element, as shown below. Next, add the background="location" attribute to the body tag, where location is the relative or absolute URL of the image. In the above example, background="bg.


2 Answers

select  {     -webkit-appearance: none; } 

If you need to you can also add an image that contains the arrow as part of the background.

like image 153
Danny G Avatar answered Oct 17 '22 14:10

Danny G


What Arne said - you can't reliably style select boxes and have them look anything like consistent across browsers.

Uniform: https://github.com/pixelmatrix/uniform is a javascript solution which gives you good graphic control over your form elements - it's still Javascript, but it's about as nice as javascript gets for solving this problem.

like image 31
Ben Hull Avatar answered Oct 17 '22 13:10

Ben Hull