No, there is currently no selector in CSS that would select elements on the basis of their descendants. You would need to use JavaScript or classes in CSS.
Most robustly, you would use a class
attribute on all links that do not contain an image and use a corresponding class selector in your CSS rule.
If most of your links do not contain an image, you could use negative approach and set a class on those links that contain an image, say class=imagelink
, and use a :not(.imagelink)
selector in CSS. Support to :not(...)
is widespread but not universal. A yet another approach, not counting on such support, is to set a bottom border on all links as in your question and then switch it off for image links:
a.imagelink {border-bottom: none;}