Style all anchors except those that contain images, without adding class or id to the image tag?
- by Deca
With the example below, I need to add padding and background-color properties to the text anchor. I then need to exclude padding and background-color from anchors that contain images.
<p>
<a href="#">this is a text link that needs to be styled</a>
<a href="#"><img src="image/name.jpg" alt="this needs to be excluded from styling" /></a>
</p>
If I have a red background and padding on my text links, I do not want that same red background and padding to appear on my linked images. The images will always be in their own anchors, not mixed with text within the same anchor.
The rub is that I can not add classes or IDs to the img tags - I do not have edit control of that data.
So how can I add CSS attributes to all anchors, while excluding anchors that contain images?