cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <header class="container">
  <h1 class="element-stack">Pinterest Flow</h1>
  <p class="element-stack">Refresh to load a new set of data.</p>
<div class="container container-masonry"></div>

<script id="item-template" type="text/x-handlebars-template">
	{{#each items}}
  <div class="item">
  	<div class="element-stack">
    	<img class="item-image" src="{{image}}" alt="" />
    <div class="item-info">
    	<div class="item-pin-count element">
      	<i class="fa fa-thumb-tack" aria-hidden="true"></i>
      <div class="element-stack">
      	<h3 class="item-title">{{title}}</h3>
     	 	<div class="item-source">{{source}}</div>
      <div class="item-user element-stack">
      	<div class="item-avatar" style="background-image: url({{avatar}});"></div>
        <div class="item-user-info">
        	<div class="item-username">{{name}}</div>
          <div class="item-tagline">{{tagline}}</div>
              $gutter: 20px;
$itemWidth: 236px;
$titelWidth: 145px;
$borderRadius: 6px;
$avatarSize: 24px;

body {
  font-family: "Helvetica Neue", Helvetica, "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", メイリオ, Meiryo, "MS Pゴシック", arial, sans-serif;
  font-size: 11px;
  line-height: 12px;

header {
  border-bottom: 1px solid #e1e1e1;

h1 {
  font-size: 20px;
  line-height: 1;
  font-weight: bold;
  color: #444;

.container {
  margin: 0 auto;

.element {
  padding: $gutter / 2;

.element-stack {
  padding: 0 ($gutter / 2);
  margin: ($gutter / 2) 0;

.item {
  width: $itemWidth + $gutter;
  border-radius: $borderRadius;
  cursor: pointer;
  &:hover {
    background: #f3f3f3;

.item-image {
  display: block;
  border-radius: $borderRadius;

.item-info {
  position: relative;

.item-pin-count {
  position: absolute;
  top: 0;
  right: 0;
  padding-top: 0;
  color: #a7a7a7;
  font-weight: bold;

.item-source {
  max-width: $titelWidth;

.item-title {
  color: #444;
  font-size: 14px;
  line-height: 16px;
  font-weight: bold;

.item-source {
  color: #b5b5b5;
  font-size: 11px;
  line-height: 12px;
  font-weight: bold;

.item-user-info {
  display: inline-block;
  vertical-align: middle;
  color: #555;

.item-avatar {
  background-color: #ccc;
  background-size: cover;
  width: $avatarSize;
  height: $avatarSize;
  border-radius: 50%;
  margin-right: 8px;

.item-username {
  font-weight: bold;
  var demo = {
    defaultOptions: {
      $container: $('.container-masonry'),
      $template: $('#item-template'),
      gutter: 20,
      imgWidth: 236,
      itemSelector: '.item',
      count: 20,
    options: {},
    items: [],
    init: function(options) {
      var self = this;
      self.options = $.extend({}, self.defaultOptions, options);
      self.getData(self.options.count, function(){
        var $container = self.options.$container;
        var html = self.generateHtml(self.options.$template, self.items);
    getData: function(count, callback) {
      for (var i = 0; i < count; i++) {
        var imageHeight = this.getRandomIntInclusive(10, 45) * 10;
          image: 'https://unsplash.it/'+this.options.imgWidth+'/'+imageHeight+'/?random',
          title: faker.lorem.sentence(),
          source: faker.company.companyName(),
          pinCount: this.getRandomIntInclusive(1, 999),
          avatar: faker.image.avatar(),
          name: faker.name.findName(),
          tagline: faker.name.title(),
      if (callback) callback();
    generateHtml: function($selector, items) {
      var source   = $selector.html();
      var template = Handlebars.compile(source);
      return template({items: items});
    startMasonry: function($container) {
        itemSelector: this.options.itemSelector,
        columnWidth: this.options.itemWidth +  this.options.gutter,
        fitWidth: true,
    loadImageMasonry: function($container) {
      $container.imagesLoaded().progress(function() {
    getRandomIntInclusive: function (min, max) {
      min = Math.ceil(min);
      max = Math.floor(max);
      return Math.floor(Math.random() * (max - min + 1)) + min;


Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


Loading ..................