There's some duplication in these examples. You could extract a helper method to get the computed style; I think the only variation between the examples is the pseudo-selector (before, after, etc).