Skip to content

Instantly share code, notes, and snippets.

Created April 4, 2017 06:05
Show Gist options
  • Save anonymous/a80f1713a1b2140b3925ac38470c9f26 to your computer and use it in GitHub Desktop.
Save anonymous/a80f1713a1b2140b3925ac38470c9f26 to your computer and use it in GitHub Desktop.
<style id="jsbin-css">
.masonry-layout {
column-count: 4;
-webkit-column-count: 4;
column-gap: 1 ;
-webkit-column-gap: 1;
}
.masonry-layout__panel {
break-inside: avoid;
-webkit-column-break-inside: avoid;
padding: 5px;
}
.masonry-layout__panel-content {
padding: 10px;
border-radius: 10px;
}
.bg--red {
background-color: #E74C3C;
}
.bg--green {
background-color: #26A65B;
}
.bg--purple {
background-color: #8E44AD;
}
.bg--orange {
background-color: #F89406;
}
</style>
<html></html>
<body>
<div class="masonry-layout">
<div class="masonry-layout__panel">
<div class="masonry-layout__panel-content bg--red">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
</div>
</div>
<div class="masonry-layout__panel">
<div class="masonry-layout__panel-content bg--orange">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
</div>
</div>
<div class="masonry-layout__panel">
<div class="masonry-layout__panel-content bg--green">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
</div>
</div>
<div class="masonry-layout__panel">
<div class="masonry-layout__panel-content bg--green">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
</div>
</div>
<div class="masonry-layout__panel">
<div class="masonry-layout__panel-content bg--red">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie. </p>
</div>
</div>
</div>
<script id="jsbin-source-html" type="text/html">html
body
.masonry-layout
- var n = 0
- var colors = ["red", "green", "purple", "orange"]
while n < 5
- var type = Math.floor(Math.random() * 4 + 1)
.masonry-layout__panel
.masonry-layout__panel-content(class="bg--#{colors[type - 1]}")
- var l = 0
while l < type
p.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec maximus tincidunt mauris non hendrerit. Morbi fringilla vehicula lectus vitae molestie.
- l++
- n++</script>
<script id="jsbin-source-css" type="text/css">.masonry-layout {
column-count: 4;
-webkit-column-count: 4;
column-gap: 1 ;
-webkit-column-gap: 1;
}
.masonry-layout__panel {
break-inside: avoid;
-webkit-column-break-inside: avoid;
padding: 5px;
}
.masonry-layout__panel-content {
padding: 10px;
border-radius: 10px;
}
.bg--red {
background-color: #E74C3C;
}
.bg--green {
background-color: #26A65B;
}
.bg--purple {
background-color: #8E44AD;
}
.bg--orange {
background-color: #F89406;
}</script>
</body>
.masonry-layout {
column-count: 4;
-webkit-column-count: 4;
column-gap: 1 ;
-webkit-column-gap: 1;
}
.masonry-layout__panel {
break-inside: avoid;
-webkit-column-break-inside: avoid;
padding: 5px;
}
.masonry-layout__panel-content {
padding: 10px;
border-radius: 10px;
}
.bg--red {
background-color: #E74C3C;
}
.bg--green {
background-color: #26A65B;
}
.bg--purple {
background-color: #8E44AD;
}
.bg--orange {
background-color: #F89406;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment