Just saw that this was a problem with SugarCube 2.21.0. It works fine in version 2.22.0+, so if upgrading is an option, you could try that.
If you want to use CSS, it'd have to be something like this:
.test {
background-color: red;
}
Use it like this:
<span class="test">YourText</span>
Not sure whether this is broken in your version of sugarcube too though, but it's worth a try.