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>
I've read other SO posts (1, 2, 3, 4) about pseudo elements in IE and most seem to point to setting some sort of position
or display
attribute which I've tried.
Is this happening as <option>
tags shouldn't contain child elements?