Judy Judy - 1 month ago 5
HTML Question

putting images with options in a dropdown list

I was trying to insert images in a drop down list. I tried the following code but its not working. What is the best way to achieve this?

<select>
<option value="volvo"><IMG src="a.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Volvo</option>
<option value="saab"><IMG src="b.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Saab</option>
<option value="mercedes"><IMG src="c.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Mercedes</option>
<option value="audi"><IMG src="d.jpg"HEIGHT="15" WIDTH="15" BORDER="0"align="center">Audi</option>
</select>

Answer

This code will work only in Firefox:

<select>
<option value="volvo" style="background-image:url(images/volvo.png);">Volvo</option>
<option value="saab"  style="background-image:url(images/saab.png);">Saab</option>
<option value="honda" style="background-image:url(images/honda.png);">Honda</option>
<option value="audi"  style="background-image:url(images/audi.png);">Audi</option>
</select>
Comments