Selector Parent css

Asked

Viewed 110 times

0

Is there any way to select using only css the images whose parent element is a <div class="img-parent" ></div>, that is to say, from a child element?

<div class="img-parent" >
   <img src="/teste.png">
</div>

Something like .img-parent < img, inverse, where the img is the daughter of the div?

  • .img-parent img will pick up all images daughters of .img-parent. That rule doesn’t fit?

  • 1

    In CSS you can’t get the parent element. You can only do this in jQuery

1 answer

-1

I’ll tell you what: .img-parent img{ //Estilo do elemento }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.