The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Custom Select and transparency

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #26325


    I’m new to the forum but I’ve been reading the blog for a while now.

    I would like your help on a little CSS probleme I haven’t been able to solve for a while now.
    I have to style a select with an image, that’s working well. But The dropdown part is dark grey, the color of my background actually. I’m quite sure it’s because of the transparency property but I have to use it to ba able to have an image, if i’m correct.

    Here is a sample of the css applied to the box:

    #search_form_right select{
    background: transparent url(“/images/form.gif”) no-repeat;
    border:solid 0 #fff;


    And here is a live example.

    How can I manage to have a white background on the dropdown?

    Thanks a lot for your help!


    Try this instead.

    background:#F3F3F4 url(/images/form.gif) no-repeat;

    You could also write it long hand like this:

    background-color: #F3F3F4; /* or white, whatever you want here */
    background-image: url(/images/form.gif);
    background-repeat: no-repeat;

    The default color where the "#F3F3F4" is written in the first example, is transparent. So if your background gif has transparent areas, the inherited background colour will show through.

    Sorry, I’m really tired.
    To answer your original question, you can use background colour in combination with background images. Hope I’ve answered your question properly.



    Thanks for your answer.
    I’ve actualy already tried that but it does not work properly on firefox it seems.
    Here’s what I see then :


    So it works > the dropdown has a white background.
    But the image is just applied on the top first pixel… Even if there is a 20px height property applied.

    Do you think I did something wrong somewhere ?


    For some reason adding this:

    padding:1px 0;

    seems to fix it — in firefox at least, not sure about other browsers.

    I really have no idea why this is working.

    Does anyone else on this forum understand the intricacies of styling selects?


    Ooooh! Thanks a looot!

    It works great! On firefox at least! I wouldn’t have though of that.

    Thank you so much!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.