6

Is it possible to place an image in a <select> dropdown list?

I tried the following piece of code

<select name="selection">
    <option><img src="dbdesign.jpg" alt="NOIMAGE"/>list1</option>
    <option><img src="dbdesign.jpg" alt="NOIMAGE"/>list2</option>
</select>

The output shows list1 and list2 but is not showing NOIMAGE, which is the alternative to src of image.

TylerH
  • 20,799
  • 66
  • 75
  • 101
RAVITEJA SATYAVADA
  • 2,503
  • 23
  • 56
  • 88

2 Answers2

4

You can't add an image to a select tag.

You can create custom menus using CSS/HTML/Javascript, but obviously this a lot more work.

tarmes
  • 15,366
  • 10
  • 53
  • 87
3

Maybe this will help you a little. It should work. Have a look at http://jsfiddle.net/jJfdr/4/

#selection option {
    background: url('dbdesign.jpg') 0 0 no-repeat;
    padding-left: 50px;
    height: 30px;
    background-size: 50%;
}
<select id="selection">
    <option>list1</option>
    <option>list2</option>
</select>
TylerH
  • 20,799
  • 66
  • 75
  • 101
Ariful Islam
  • 7,639
  • 7
  • 36
  • 54