Forums

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
    Posts
  • #26325
    Yuko
    Member

    Hello!

    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:

    Code:
    #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!

    #64983
    Dominic
    Member

    Try this instead.

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

    You could also write it long hand like this:

    Code:
    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.

    EDIT.
    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.

    #65000
    Yuko
    Member

    Hello!

    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 :
    [img]http://marionbouguet.com/bed-style/web/images/Image1.png[/img]

    [img]http://marionbouguet.com/bed-style/web/images/Image2.png[/img]

    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 ?

    #65001
    Dominic
    Member

    For some reason adding this:

    Code:
    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?

    #65002
    Yuko
    Member

    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.