I am attempting to customize the appearance of any child divs with the class 'header' that are within parent divs with a class of 'recipes'.
I understand that I could simply target .category-recipes .header
, but the parent div may vary depending on the user's location. For example, it could be 'category-recipes' on a category page or 'single-page-recipes' on a single post page.
Here is a simplified example of what a page structure might look like:
<div class="category-recipes">
<div class="otherdiv"></div>
<div class="otherdiv"></div>
<div class="header"></div>
</div> <!-- end of category -->
I attempted to implement this style, but it did not have the desired effect.
div[class*="recipes"] .header{
margin-bottom: 40px;
}
Is there a way to target a child or parent element using this type of selector?