Apply style if element exists

I need to use CSS to apply style to class article ONLY if class subject is present inside .container

<div class="container">
  <div class="subject">
  <div class="article">

I was trying to use sibling selector, but it does not seem to work. What am I missing?

.container + .subject .article { ... }


The adjacent sibling combinator is meant for sibling elements. Your selector wasn’t working because .container and .subject are not siblings, .subject is a child of .container.

.container .subject + .article

The elements .subject and .article are siblings, therefore it should work.

Example Here