I'm trying to add some CSS ::before
content to the <option>
tags of a <select multiple>
depending on if the option is selected or not.
The below is currently working fine in Chrome & FF, but I'm having issues in IE11.
select > option::before {
display: inline-block;
width: 10em;
}
select > option:checked::before {
content: "SELECTED: ";
}
select > option:not(:checked)::before {
content: "excluded: " ;
}
<select multiple>
<option value="1" selected="selected">1</option>
<option value="2" selected="selected">2</option>
<option value="3" selected="selected">3</option>
<option value="4" selected="selected">4</option>
<option value="5" selected="selected">5</option>
</select>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…