Last Updated: February 25, 2016
·
1.765K
· not-only-code

Force IE to redraw pseudo-elements

If you have something like this:

div:after {
     content: '';
     position: absolute;
     top: 0;
     height: 0;
     width: 15px;
     height: 15px;
     background-color: gray;
}

div.active:after {
     background-color: orange;
}

And you want to change the state of this div with JavasScript adding active class, you must to know that IE doesnt redraw pseudo-elements if their content dont change, then remember to change the content when state changes:

div.active:after {
     content: ' ';
     background-color: orange;
}