Image may be NSFW.
Clik here to view.
Clik here to view.

CSS now includes a :has selector that allows us to apply styles on the basis of what is happening inside an element. Often referred to as a parent seletor, the :has() function allows us to achieve this and more. Let us take a look at this relative selector. CSS It only applies the background if there is an image inside the div, otherwise, it will not. So HTML will get…