Struggling with aligning the divs in a row when floating one of them? Here's a snippet to illustrate the issue:
.flex-grid {
display: flex;
justify-content:space-between;
}
.flex-grid .rcorners1 {
border-radius: 25px;
background: green;
padding: 10px;
width: 21.5%;
height: 145px;
padding: 16px;
margin: .50em 0;
z-index:0;
position:relative;
overflow: hidden;
overflow-x: hidden;
}
.flex-grid .rcorners2 {
border-radius: 25px;
background: green;
padding: 10px;
width: 28%;
height: 200px;
top:180px;
padding: 16px;
margin: .50em 0;
z-index:1;
border-style:solid;
border-width:5px;
border-color:#a6a6a6;
position:absolute;
overflow: hidden;
overflow-x: hidden;
}
<div class="flex-grid">
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
</div>
<div class="flex-grid">
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
</div>
<div class="flex-grid">
<div class="rcorners1">Sample</div>
<div class="rcorners2">Sample Selected</div>
<div class="rcorners1">Sample</div>
<div class="rcorners1">Sample</div>
</div>
When a div is floated, the alignment of other divs on the row gets disrupted as shown in the third row with "Sample Selected". The remaining divs do not align properly causing a gap. Any suggestions on how to address this alignment issue?
Thank you!