Answers for "how to make a dropdown image in html"

1

how to put an image in a dropdown html

<!--Doesn't work in internet explorer-->

<select name="countries" id="countries" class="icon-menu">
<option value="">Select a Country</option>
<option value="US">USA</option>
<option value="IN">India</option>
</select>


CSS

select.icon-menu option {
background-repeat:no-repeat;
background-position:bottom left;
padding-left:30px;
}
select#countries option[value="US"] {
background-image:url(flags/usa.png);
}
select#countries option[value="IN"] {
background-image:url(flags/india.png);
}
Posted by: Guest on January-01-2021

Code answers related to "how to make a dropdown image in html"

Browse Popular Code Answers by Language