xhtml
Images in a select box
by Mark on Apr.12, 2009, under xhtml
Can you have images in a drop down select box?
Test 1
This one is a select box with images for options:
code: “<select><option value=”UK”><img src=”images/uk.gif” alt=”UK” /></option></select>”
doesnt work and also failed to validate: (document type does not allow element “img” here)
Test 2
This example uses background colors/images and a bottom border on the options
background images and borders only work in firefox.
Background colors work in IE / firefox / safari / Opera / Chrome
Test 3
This one is a div with images inside like <div id=”divscroller”>
<img src=”/images/uk.gif” alt=”UK” /></div>






I didnt pursue this avenue but I imagine you can use onclick to populate a hidden form field with some value. Could be buggy.
Javascript solution
Some javascript solutions I found but havn’t tried:
Check out dhtmlxCombo
I hope this information was at least slightly informative… please post a comment if you have any suggestions that might help others
Looking for something?
Use the form below to search the site:
Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!
















