If your goal is to style the images with CSS, then targeting them with CSS-specificity is the way to go. It is not a workaround, but could be semantically “clearer” if you were to assign a class to the image itself and target that. The end result is the same, though.