How to put background image in select option tag using css

后端 未结 2 958
旧时难觅i
旧时难觅i 2021-01-28 02:09

I have a country dropdown list receiving from json response, and want to add respective country flag icons (getting the images as well from json reponse) next to the country nam

相关标签:
2条回答
  • 2021-01-28 02:42

    You can't give an option tag a background-image.

    One solution will be to create your own "select" component.

    <ul>
         <li>option1</li>
         <li>option2></li>
         ..
    </ul>
    

    then you give some css to look like a select input.

    And some javascript to handle showing and hiding "li" elements

    0 讨论(0)
  • 2021-01-28 02:45

    Its not possible as option tag. you can use custom dropdown list. http://tympanus.net/Tutorials/CustomDropDownListStyling/index2.html

    0 讨论(0)
提交回复
热议问题