I am trying to align vertical all divs as shown in the image.so far I have everything with margins and paddings in % and it works. But i think is a bit old school, and maybe could be done using another method.
Other solutions as display table, table-cell, flex dont help at all...
.holder {
width:80%;
height:30%;
position: relative;
margin: 0 auto;
}
.item-1 {
position: absolute;
z-index: 1;
width: 20%;
height: 20%;
background: red;
left: 0;
}
.item-2 {
position: absolute;
z-index: 2;
width: 25%;
height: 30%;
background: blue;
right:0;
}
.item-1:after, .item-2:after {
content:'';
display: block;
padding-bottom: 100%;
}
.txt-holder {
position: absolute;
z-index: 11;
width: 40%;
margin: 0 auto;
background: gold;
left: 0;
right: 0;
}
Basically the html structure goes like this.
<div class="holder">
<div class="item-1"></div>
<div class="txt-holder">
<h1>header title</h1>
<p>any texts</p>
</div>
<div class="item-2"></div>
</div>