I have a simple grid with 5 divs, each one containing an image.
Why the last div (with the different image) has an offset? It gets pushed down for no apparent reason.
Example here.
CSS
.thumb-container {
border: 1px solid #e5e5e5;
padding: 15px;
margin-right: 15px;
margin-bottom: 15px;
width: 130px;
height: 130px;
display: inline-block;
}
JavaScript
$.when( loadImageSet(imageURLs) ).then(function(data){
var imageSet = [];
$.each(data, function(index, value){
imageSet.push(value);
})
for (var i = 0; i < imageSet.length; i++) {
var thumbContainer = $('<div>',
{class: 'thumb-container'});
img = resizeImage(imageSet[i], 100);
thumbContainer.append(img);
$('.box').append(thumbContainer);
}
});
EDIT
I got it, I need to set vertical-align: top
to .thumb-container or display:block
to the img. But still don't understand why it behaves that way.