title: Detecting if a div above has margin in CSS?
body: <p>I currently have two elements:</p>
  
  <pre><code>.item-one {
      margin-bottom: 24px;
  }
  ..other-elements..
  .item-two {
      margin-top: 48px;
  }
  </code></pre>
  
  <p>These items are fine on their own, but say, if I removed the <code>..other elements..</code> between them, so they'd be one after another, I would be left with a total margin (visually) of 72px.</p>
  
  <p>The <code>..other elements..</code> have a consistent 24px, because of the flow, but my app is dynamic and users can switch places of elements.</p>
  
  <p>Unfortunately, this is highly undesirable as it'd result in bad looking spaces.</p>
  
  <p>I'd like to write something like</p>
  
  <pre><code>.item-two [if-div-is-previous -&gt; .item-one] {
      //this will set the margin to 0 only if preceded by .item-one
      margin-top: 0px;
  }
  </code></pre>
  
  <p><strong>In short, I'm trying to keep a consistent distance between all the elements on the page of 24 px, even when items that have different margins than 24px are one after another.</strong></p>