'Set a background if item has an item with specific class with css

I want to set a background to parent element if it has an item with 'open' class item with css. Main goal is add a background color the parent element.

For example:

<div class='parent'>
    <span class='title'>title</span>
    <span class='arrow open'>I should have a blue background!</span>
</div>
css


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source