The problem with this that I cannot set the image width and height (READ : I don’t know HOW CAN I do it within CSS…) so only the left upper corner of the image is displayed… I tried to find an example on some forums, with no results so far… Can someone help me? Thanks advanced!
well, if you know exactly how big the image is and if all of them are the same size, you can include it in your options tag… otherwise you could perhaps try adding a percentage height…
Thank you MJ Pieterse for your help, however your solution is not working (FF 3.6.12)…
I tried both your options, it ‘takes’ the upper left corner of the images and does not scale them to the given width/height…
The background will only show within the height available to it or within the height set by the content. You could set the height of the option element as mentioned above to cater for the height of the image but I don’t think that’s what you meant.
You would however need to set the image to be background-position:0 0 and not bottom:left as bottom :left will place the bottom of the image at the bottom of the available space and you said you wanted the upper left of the image to be visible.
With css3 you can resize, clip and change background origins but isn’t well supported yet so isn’t really must use here.
Note that I believe that Firefox is the only browsers that will let you place a background image in the option element anyway. You would probably be better off with a javascript replacement for cross browser compatibility.
oh yes… i actually just saved the whole thing and tried to impement it just using normal elements, but you will have to use js or create a component since it is a form element