I have 3 elements inline-block
. There are 3 squares aligned, in short.
So when I put a div
"daughter" in one of them, it drops and the other empty ones stay in position. It's the same with everyone.
But if I put a div
daughter in (fill in) ALL, they keep in the correct position. Otherwise, they fall.
Look at the 3 divs containing <figure>
and <p>
, everything aligns.
.blocoexp{
display:inline-block;
width:100px;
height:300px;
border:1px solid black;
}
.blocoexp figure{
width:30%;
height:80px;
border:1px solid black;
}
.blocoexp p{
width:30%;
height:80px;
border:1px solid black;
word-break:break-all;
}
<div class="blocoexp">
<figure></figure>
<p>asdasdasd</p>
</div>
<div class="blocoexp">
<figure></figure>
<p>asdasdasd</p>
</div>
<div class="blocoexp">
<figure></figure>
<p>asdasdasd</p>
</div>
Now see if I remove the contents of one of the divs.
.blocoexp{
display:inline-block;
width:100px;
height:300px;
border:1px solid black;
}
.blocoexp figure{
width:30%;
height:80px;
border:1px solid black;
}
.blocoexp p{
width:30%;
height:80px;
border:1px solid black;
word-break:break-all;
}
<div id="blocoexpai">
<div class="blocoexp">
<figure></figure>
<p>asdasdasd</p>
</div>
<div class="blocoexp">
<figure></figure>
<p>asdasdasd</p>
</div>
<div class="blocoexp">
</div>
</div>
Tcharam! It only remains empty, the others fall.