Skip to content

Instantly share code, notes, and snippets.

@pgarciacamou
Created February 23, 2015 00:50
Show Gist options
  • Save pgarciacamou/b81e7ac0e59977ac9ad1 to your computer and use it in GitHub Desktop.
Save pgarciacamou/b81e7ac0e59977ac9ad1 to your computer and use it in GitHub Desktop.
This piece of code will use the CSS3 column-count property to display images in a -Pinterest-esque way.
<!DOCTYPE html>
<html>
<head>
<style>
.images {
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-moz-column-count: 3; /* Firefox */
column-count: 3;
}
.images img { width: 100%; }
</style>
</head>
<body>
<p>Internet Explorer 9, and earlier versions, does not support the column-count property.</p>
<div class="images">
<img src="http://dummyimage.com/600x400/000/fff">
<img src="http://dummyimage.com/600x500/000/fff">
<img src="http://dummyimage.com/600x300/000/fff">
<img src="http://dummyimage.com/600x400/000/fff">
<img src="http://dummyimage.com/600x500/000/fff">
<img src="http://dummyimage.com/600x300/000/fff">
<img src="http://dummyimage.com/600x400/000/fff">
<img src="http://dummyimage.com/600x500/000/fff">
<img src="http://dummyimage.com/600x300/000/fff">
<img src="http://dummyimage.com/600x400/000/fff">
<img src="http://dummyimage.com/600x500/000/fff">
<img src="http://dummyimage.com/600x300/000/fff">
<img src="http://dummyimage.com/600x400/000/fff">
<img src="http://dummyimage.com/600x500/000/fff">
<img src="http://dummyimage.com/600x300/000/fff">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment