Paul Taylor
Paul Taylor

Reputation: 13140

How I do I put images as well as text into Html select tag

I currently have a button for each language to allow users to view website in difference languages

<a href="http://www.jthink.net/songkong/en" title='English'><img src="http://static.albunack.net/images/flags/flags-iso/shiny/32/GB.png" alt="English" height="32" width="32" valign="top"></a>&nbsp;
<a href="http://www.jthink.net/songkong/de" title='Deutsch'><img src="http://static.albunack.net/images/flags/flags-iso/shiny/32/DE.png" alt="Deutsch" height="32" width="32"  valign="top"></a>&nbsp;
<a href="http://www.jthink.net/songkong/es" title='Español'><img src="http://static.albunack.net/images/flags/flags-iso/shiny/32/ES.png" alt="Español" height="32" width="32"  valign="top"></a>&nbsp;
<a href="http://www.jthink.net/songkong/fr" title='Français'><img src="http://static.albunack.net/images/flags/flags-iso/shiny/32/FR.png" alt="Français" height="32" width="32"  valign="top"></a>&nbsp;

I now want to use a drop down to save space, but how do I output the flag image as well as the text in the options, currently I have

<select>
  <option value="en">English</option>
  <option value="de">Deutsch</option>
  <option value="es">Español</option>
  <option value="fr">Français</option>
</select> 

Upvotes: 1

Views: 14613

Answers (1)

Michał Perłakowski
Michał Perłakowski

Reputation: 92669

You can't have any HTML in option tag, but you can use background-image in CSS. See this: How to add a images in select list.

Upvotes: 1

Related Questions