I have to add colored bordered boxes at the right of each option of a "select".
My html code is:
<select id="" name="" size="0" class="">
<option value="label_0" class=" level-label"></option>
<option value="241" class="has-no-children" selected="selected">White</option>
<option value="242" class="has-no-children">Black</option>
<option value="243" class="has-no-children">Red</option>
</select>
and my CSS:
select option {
position: relative;
}
select option:after {
content: "";
width: 10px;
height: 10px;
border: 1px solid #222;
background-color: white;
display: inline-block;
position: absolute;
}
select option:nth-child(2):after {
background-color: black;
}
select option:nth-child(3):after {
background-color: red;
}
Unfortunately, no :after element appears on html.
Note that I don't have the opportunity to edit the select html (by php probably), so I have to make it by CSS or jQuery only.