I'm struggling with adjusting the margin between two child divs when they follow each other. The current margin is set at 3rem, but I want it to be 1rem if both child containers have the class "narrow":
Is there a way to achieve this without changing the code for field_item
? I'm open to using jQuery as a last resort.
For example:
<body>
<div class="field_item">
<div class="narrow video-block">narrow video-block</div>
</div>
<div class="field_item">
<div class="narrow video-block">narrow video-block</div>
</div>
<body>
Here's some pseudo code to illustrate my question:
IF field_item.narrow is followed by .field_item.wide
THEN margin-bottom is 5rem.
ELSE IF field_item.narrow is followed by .field_item.narrow
THEN margin-bottom is 1rem.
Any suggestions or solutions would be greatly appreciated!