0

I have this markup:

<div class="parent">
   <img class="selected child"/>
</div>
<div class="parent">
   <img class="child"/>
</div>

What I would like to do is to make an :after to the "parent" div that has class=selected only.

That means I'd like to make :after to the first one, because it has a child with class "selected".

I can not use:

.parent:after .selected {}

If I use

.parent .selected:after {}

it is not good as the img get :after content and it doesn't work, I need to put :after to the parent of the image.

Jerry2
  • 2,595
  • 5
  • 27
  • 37
  • 1
    You're looking for [:has](https://caniuse.com/#feat=css-has), but it is only still a working draft and not supported by basically anything yet. In other words, if you want to select a parent, you will need to use JS for now. – Roope Jan 05 '20 at 18:47
  • Oh, sorry to hear that. Thanx for the answer. – Jerry2 Jan 05 '20 at 19:01

0 Answers0