No, there is no selector in CSS that selects elements based on their descendants. You will need to use JavaScript or classes in CSS.
Most reliably, you should use the class attribute for all links that do not contain an image, and use the appropriate class selector in your CSS rule.
If most of your links do not contain an image, you can use the negative approach and set the class on those links that contain the image, for example class=imagelink , and use the :not(.imagelink) selector in CSS. Support :not(...) is widespread, but not universal. Another approach that does not take into account such support is to set the lower border for all links, as in your question, and then disable them for image links:
a.imagelink {border-bottom: none;}
Jukka K. Korpela
source share