1

How would I add a background image to a list element in a jQuery Chosen select dropdown?

There is already a question on this, but I can't get the accepted answer to work.

My code:

.chzn-results li {
  background-image: url('http://placekitten.com/20/20') no-repeat 3px center;
  padding-left: 12px;
}

JSFiddle to show the problem: http://jsfiddle.net/RVH8D/

4

2 回答 2

1

习惯这个background比习惯all properties

.chzn-results li {
    background: url('http://placekitten.com/20/20') no-repeat 3px center;
    padding-left: 12px;
}

==========

如果你正在使用

background-image: 

比习惯这种方式

.chzn-results li{
background-image: url('http://placekitten.com/20/20');
background-repeat:no-repeat;
background-position:3px center;
}

演示

于 2013-07-30T10:33:03.093 回答
0

尝试这个

http://jsfiddle.net/RVH8D/6/

CSS

.chzn-results li {
    background: url('http://placekitten.com/20/20') no-repeat 3px center;

}
li.active-result { 
    padding-left: 12px;    
}
.chzn-results, .chzn-single { 
    font-family: Arial;    
}
.chzn-container .chzn-results li{padding-left: 25px;}
于 2013-07-30T10:41:03.353 回答