In the following code snippet I am trying to make the third div element (the green one) to occupy the free space above it. I am looking for the most abstract solution. What I mean is that I am not looking for a solution with exactly three inner divs and two-column scenario. What is more, I dont want to use bootstrap or any other plugin.
.outer {
background-color: yellow;
width: 500px;
height: 500px;
}
.inner-1 {
float: left;
background-color: red;
align-self: start;
}
.inner-2 {
float:left;
background-color: lightblue;
align-self:start;
}
.inner-3 {
float:left;
background-color:green;
align-self:start;
}
.p-1 {
width:200px;
height:200px;
}
.p-2 {
width:200px;
height:250px;
}
.p-3 {
width:200px;
height:200px;
}
.inner-1::after{
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.inner-2::after{
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.inner-3::after{
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
<div class="outer">
<div class="inner-1">
<div class="p-1">one</div>
</div>
<div class="inner-2">
<div class="p-2">two</div>
</div>
<div class="inner-3">
<div class="p-3">three</div>
</div>
</div>