Using chosen.js, how would I add images to the dropdown items?

久未见 提交于 2019-12-04 12:36:56

问题


Using chosen.js, how would I add images to the dropdown items?


回答1:


By setting a background-image on chosen's list items:

.chzn-results li {
    background: url('path/to/img.png') no-repeat 3px center;
    padding-left: 12px;
}

Adjust the pixel count accordingly.




回答2:


To complete Joseph (I can't add comment to his answer), the class has changed since an unknown version: Here's the correct css in v1.0.0:

li.active-result {
    background: url('path/to/img.png') no-repeat 3px center;
    text-indent:2em;
}

Thx Joseph!



来源:https://stackoverflow.com/questions/12271283/using-chosen-js-how-would-i-add-images-to-the-dropdown-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!