I've gone through all the posts related to this issue, but none of the suggested solutions seem to work for me.
Here is a visual representation of my grid:
https://i.sstatic.net/ybufk.png
If you want to see the code and play around with it, check out this jsfiddle. Below is the HTML snippet provided:
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Masonry -->
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
<link rel="stylesheet" href="css/style.css">
<!-- imagesLoaded -->
<script
src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ae3e7ebedeff9e6e5ebeeefeecabea4bb">[email protected]</a>/imagesloaded.pkgd.min.js">
// Initialize Masonry
var $grid = $('.grid').masonry({
itemSelector: '.grid-item',
percentPosition: true,
columnWidth: '.grid-sizer'
});
// Rearrange layout after each image loads
$grid.imagesLoaded().progress( function() {
$grid.masonry('layout');
});
</script>
<!-- Bootstrap -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<body>
<div class="container">
<div class="grid">
<div class="grid-item">
<img src="http://hiphopgoldenage.com/wp-content/uploads/2015/10/MellowManAce.jpg" alt="Mellow Man Ace">
</div>
<div class="grid-item">
<img src="https://pbs.twimg.com/media/C2O6p6ZWgAA67jA.jpg" alt="...">
</div>
<div class="grid-item">
<img src="http://images1.mtv.com/uri/mgid:file:docroot:mtv.com:/shared/promoimages/bands/c/cypres_hill/photos/cr_rene_cervantes/flipbook/CH-0141.jpg?enlarge=false&matte=true&matteColor=black&quality=0.85" alt="...">
</div>
<div class="grid-item">
<img src="https://cdn-images-1.medium.com/max/600/1*VfCrfkNhTVwAxftgfebcog.jpeg" alt="...">
</div>
<div class="grid-item">
<img src="https://images.genius.com/ace91b03cd16b6f3678660cd184af26a.500x323x1.jpg" alt="...">
</div>
<div class="grid-item">
<img src="https://images.pexels.com/photos/271560/pexels-photo-271560.jpeg" alt="...">
</div>
<div class="grid-item">
<img src="https://images.pexels.com/photos/147504/pexels-photo-147504.jpeg" alt="...">
</div>
<div class="grid-item">
<img src="https://images.pexels.com/photos/99551/hot-air-balloon-valley-sky-99551.jpeg" alt="...">
</div>
</div>
CSS:
* { box-sizing: border-box; }
/* Ensure scrollbar visibility */
html { overflow-y: scroll; }
/* body { font-family: sans-serif; } */
/* ---- Grid Style ---- */
.grid {
background: #DDD;
}
/* Clearfix */
.grid:after {
content: '';
display: block;
clear: both;
}
/* ----Individual Grid Item Styling---- */
.grid-sizer,
.grid-item {
width: 33.333%;
float: left;
}
.grid-item img {
display: block;
max-width: 100%;
}
What am I missing here? Your guidance would be greatly appreciated. Thank you!