0

for some reason my image won't display in my select option.

<select>
   <option><img src="img/pic1.png" style="height:16px;width:16px;margin-left:4px">Option 1</option>
   <option><img src="img/pic1.png" style="height:16px;width:16px;margin-left:4px">Option 2</option>
   <option><img src="img/pic1.png" style="height:16px;width:16px;margin-left:4px">Option 3</option>
</select>

(Code simplified to understand problem, however, there are no special CSS arguments etc. for the options)

corv1njano
  • 21
  • 2

2 Answers2

1

<option>’s specification does not permit the use of non-textual information in its definition. MDN’s page for <option> spells this out pretty clearly:

Permitted content

Text, possibly with escaped characters (like &eacute;).

Suffice to say that <img> elements for not meet this standard.

esqew
  • 42,425
  • 27
  • 92
  • 132
0

The <option> element, and therefore the select, can only contain text, not images.

Ian Devlin
  • 18,534
  • 6
  • 55
  • 73