Adding images with option tag [duplicate]

It’s not possible, as <option> only supports text.

You may have to roll your own drop-down control using complex HTML/CSS/JavaScript. How to do it may or may not be within the scope of your question.

Alternatively, you may use a non-repeating background-image and apply some padding on the text to achieve a similar effect. But if each <option> is to have a unique image, your code is going to be polluted with a style attribute for every single <option>. If you don’t mind that, it’s fine. Otherwise, roll your own somehow.

Leave a Comment