That title might not be very accurate but here is the situation:
The reason why your layout is breaking is due to the dynamic height of the images being presented. The fix is simple though, just constrain the height of the images. For example
.file-block {
border: 1px solid #ccc;
border-radius: 10px;
margin: 20px 0px;
text-align: center;
}
.file-thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
height: 180px;
font: 0/0 a; /* remove the gap between inline(-block) elements */
}
.file-thumbnail:before {
content: ' ';
display: inline-block;
vertical-align: middle; /* vertical alignment of the inline element */
height: 100%;
}
.file-thumbnail img {
display: inline-block;
margin: 0 auto;
max-width: 150px;
max-height: 180px;
vertical-align: middle;
}
Check out the CodePen to see it in action. Hope this helps.