JSFiddle - React, Tailwind, and code Playground
by Zer00ne Null
HTML
<div class="column">
<div>
Element 1
</div>
<div>
Element 2
</div>
<div>
Element 3
</div>
<div>
Element 4
</div>
<div>
Element 5
</div>
</div>
<div class="column">
<div>
Element 1
</div>
<div id="fixed">
Element 2
</div>
<div>
Element 3
</div>
<div>
Element 4
</div>
<div>
Element 5
</div>
</div>
<br>
<p>
The space between Element 1 and Element 3 in the second column should be the same height as the other spaces.
</p>
CSS
.column {
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
height: 300px;
float: left;
margin: 10px;
border: 3px solid black;
}
.column > div {
display: flex;
justify-content: center;
align-items: center;
width: 200px;
height: 50px;
background-color: red;
}
#fixed {
position: fixed;
top: 0;
right: 0;
}
.spacer {
visibility: hidden;
}
br {
clear: both;
}
JavaScript
var spacer = document.createElement('div');
var secondCol = document.querySelector('div.column:nth-of-type(2)');
spacer.classList.add('spacer');
secondCol.appendChild(spacer);