The style is cascading ☺ But I suppose you know that. The styles are being applied to the anchor wrapping the image, so you would need a selector that targets the parent a tag which is surrounding your image. Unfortunately, I don’t think their is one.
Classes applied to either type of a tag will solve the problem.
A tiny bit of jQuery will help too (either by adding a class to the parent a tag or removing style declarations), but even then, tis alot easier if you just use classes in the markup and address them in your css rules.