I am trying to add background images to the select options of a dropdown.
This is the code I am using:
<html>
<head>
<style>
.flag16
{
height:16px;
width:16px;
background:url(http://imgur.com/l2KaB.png) no-repeat;
}
.flag16.us{background-position:0 -3664px;}
.flag16.il{background-position:0 -1824px;}
.flag16.in{background-position:0 -1856px;}
.flag16.it{background-position:0 -1920px;}
</style>
</head>
<body>
<select id="my_select" style="width: 180px;height:20px;">
<option value="some Value 1" class="flag16 us">USA</option>
<option value="some Value 2" class="flag16 il">Israel</option>
<option value="some Value 3" class="flag16 in">India</option>
<option value="some Value 4" class="flag16 it">Italy</option>
</select>
</body>
</html>
JSFiddle here: http://jsfiddle.net/26Wgq/4/
How do I get all the images to align to the right?
Also, this snippet works only in Firefox. How to get it working in all browsers?