title: get the height of the previous element
body: <p>Can i get the height of the previous element using only CSS?
  I am using calc() function to set dynamically height of the div B.</p>
  
  <pre><code>#b{
    height:calc(100vh - heightOfPreviousElement);
  }
  </code></pre>
  
  <p>I need to know the height of the previous element.</p>
  
  <p><a href="https://i.stack.imgur.com/ZFa9t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZFa9t.png" alt="enter image description here"></a></p>
  
  <p>what i know is that, 100vh is equal to 100% of the screen height.</p>
  
  <p>I used the code in the answer below.Using flex,</p>
  
  <p>I have one problem. The height of the color orange become smaller.
  <a href="https://i.stack.imgur.com/aiNck.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aiNck.png" alt="enter image description here"></a></p>