title: Change a:after style if child is img
body: <p>I am styling a hovered anchor by applying content with the :after pseudo attribute, which adds a border underneath:</p>
  
  <pre><code>a:hover {
      position: relative; }
      a:hover:after {
          content: '';
          position: absolute;
          left: 0;
          display: inline-block;
          height: 1em;
          width: 100%;
          border-bottom: 1px solid #a5cf4c;
          margin-top: 0.5em; }
  </code></pre>
  
  <p>This works fine, but there are also some anchors around images, and I don't want the border under them. For CSS this would only work with the non-existent parent selector <code>a:after &lt; img</code>. I tried solving it with jQuery, but</p>
  
  <blockquote>
    <p>You can't manipulate :after, because it's not technically part of the DOM and therefore is inaccessible by any JavaScript. See <a href="https://stackoverflow.com/questions/17788990/access-the-css-after-selector-with-jquery">Access the css &quot;:after&quot; selector with jQuery</a>.</p>
  </blockquote>
  
  <p>I looked some solutions on SO without the parent hurdle, but I can't get anywhere with this. Anyone?</p>