I have a select with multiple options that I want to set many combinations of background images as flags for the elements in the select list, something like this
The CSS
option{width:300px;}
option.online{background: url(media/flags/online.png) no-repeat right 0px center;}
option.full{background: url(media/flags/full.png) no-repeat right 20px center;}
option.online.full{background: url(media/flags/online.png) no-repeat right 00px center, url(media/flags/full.png) no-repeat right 20px center;}
The HTML
<select multiple>
<option class="online full">p1-soldiers(R)</option>
<option>p2-Blackberry(R)</option>
<option>p3-RICK(R)</option>
<option>p4-Aj Lifestyle(R)</option>
<option>p5-abosaleh(R)</option>
<select>
I have many flags that I want to set for the options , every flag is a 20px*20px png image
At the first 20px from right I want to set the online flag it can be
- online
- offline
- online for too long
- offline for too long
At the second 20px from right I want to set the warehouse flag it can be
- full
- empty
- normal
At the third 20px from right I want to set another flag with 4 possibilities
At the fourth 20px from right I want to set another flag with 3 possibilities
The problem with current approach I used from this question is that I will write a rule for every possible combination of flags which will be (4 + 3 + 4 + 3 + (4*3*4*3))
for example
option.online{}
option.offline{}
option.onlineTooLong{}
option.offlineTooLong{}
option.full{}
option.online.full{}
option.offline.full{}
/* ...... etc */
I may also add a 5th flag in the future with 6 possibilities :(
Is there any CSS way to add only one rule for each flag, not for each combination ?