In my situation, the problem was that I wanted to display two different images depending on the css class applied to the body tag. I could just use display: not one on which I would not want to show, but that would require loading both when only one is needed, so I ended up like this:
HTML:
<div class='arrow'> <img src="/img/arrow.png" style='max-width: 100%;'> </div>
CSS:
.arrow { max-width: 100%; overflow: auto; } .darktheme .arrow { background: url(/img/arrow-darktheme.png) center no-repeat; } .darktheme .arrow img { opacity: 0; }
It loads both in the dark theme, but only one if the dark theme does not apply.
source share