cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-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.

            
              <div class="page">
  <header>
    <h1><a href="http://justifygrid.com">Justify Grid</a></h1>
  </header>
  <nav>
    <p>Justify Grid is a new way to create layouts.
       Click on logo for more info.</p>
  </nav>
  <div class="main">
    <h1>Image Gallery</h1>
    <div class="image"></div>
    <div class="image"></div>
    <div class="image"></div>
  </div>
  <footer>
    <p>Justify Grid is produced by <a href="http://crocodillon.com">CrocoDillon</a></p>
  </footer>
</div>
            
          
!
            
              @import "compass/css3";

/* Example: Simple 2-column layout */
.page {
  text-align: justify;
  text-justify: distribute-all-lines;
}
header, nav, footer {
  text-align: left;
}
nav, .main, footer {
  vertical-align: top;
  display: inline-block;
  width: 100%;
}
nav {
  width: 17em / 75.5em * 100%; /* Sass */
}
.main {
  width: 56em / 75.5em * 100%; /* Sass */
}

/* Example: Justify aligning last row */
.main {
  text-align: justify;
  text-justify: distribute-all-lines;
  font-size: 0;
}
.opera .main {
  font-size: 0.5px; /* Opera fix, bugged if set to 0 */
}
.main:after {
  content: '';
  display: inline-block;
  width: 100%;
}
h1, .image {
  text-align: left;
  font-size: medium;
}
.image {
  vertical-align: top;
  display: inline-block;
  width: 17em / 56em * 100%; /* Sass */
  height: 0;
  padding-bottom: 13.8393%;
  background: #ccc;
}

/* Presentational styles */
html, body {
  padding: 0;
  margin: 0;
  color: #333;
  font: 300 100%/1.5 'Open Sans', sans-serif;
}
html {
  min-height: 100%;
  background-color: #8495a5;
  background-image:
    -webkit-linear-gradient(top, rgba(181,191,201,0.5), rgba(79,89,99,0.5)),
    -webkit-radial-gradient(center top, rgba(132,149,165,0.6), #8495a5 80%),
    -webkit-linear-gradient(top, #ffffff 1px, transparent 1px),
    -webkit-linear-gradient(left, #ffffff 1px, transparent 1px);
  background-image:
    -moz-linear-gradient(top, rgba(181,191,201,0.5), rgba(79,89,99,0.5)),
    -moz-radial-gradient(center top, rgba(132,149,165,0.6), #8495a5 80%),
    -moz-linear-gradient(top, #ffffff 1px, transparent 1px),
    -moz-linear-gradient(left, #ffffff 1px, transparent 1px);
  background-image:
    -o-linear-gradient(top, rgba(181,191,201,0.5), rgba(79,89,99,0.5)),
    -o-radial-gradient(center top, rgba(132,149,165,0.6), #8495a5 80%),
    -o-linear-gradient(top, #ffffff 1px, transparent 1px),
    -o-linear-gradient(left, #ffffff 1px, transparent 1px);
  background-image:
    linear-gradient(to bottom, rgba(181,191,201,0.5), rgba(79,89,99,0.5)),
    radial-gradient(at center top, rgba(132,149,165,0.6), #8495a5 80%),
    linear-gradient(to bottom, #ffffff 1px, transparent 1px),
    linear-gradient(to right, #ffffff 1px, transparent 1px);
  background-size: auto, auto, 1em 1em, 1em 1em;
  background-position: 50% -1px;
}
body {
  margin: 0 1em;
}
h1 {
  margin: 0;
  font-family: 'Josefin Slab', serif;
  font-weight: 700;
  line-height: 1.5;
}
a {
  color: #fff;
}
.page {
  max-width: 75.5rem;
  margin: 0 auto;
}
header > h1 {
  color: #fff;
  font-size: 48px;
  font-size: 3rem;
  text-shadow: 0.05em 0.05em 0.1em rgba(0, 0, 0, 0.4);
}
header a {
  text-decoration: none;
}
nav, .main {
  background: rgba(255, 255, 255, 0.2);
}
nav {
  height: 3em;
  padding-bottom: 10.2649%;
}
nav > p {
  margin: 0.5em;
}
@media screen and (max-width: 50em) {
  nav > p {
    font-size: 0.75em;
  }
}
@media screen and (max-width: 35em) {
  nav > p {
    display: none;
  }
}
.main > h1 {
  margin: 0 0.25em;
  font-size: 32px;
  font-size: 2rem;
}
@media screen and (max-width: 25em) {
  nav {
    height: 2.25em;
  }
  .main > h1 {
    font-size: 1.5rem;
  }
  footer {
    font-size: 0.75em;
  }
}
.image img {
  display: block;
  max-width: 100%;
}
footer {
  color: #fff;
}
            
          
!
            
              /*
 * More info:
 * http://justifygrid.com/
 *
 * Created by:
 * https://twitter.com/CrocoDillon
 */

// Opera doesn't like font-size: 0, this changes it to 0.5px :)
if (window.opera)
  document.documentElement.className += ' opera';
            
          
!
999px
Close

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.

Go PRO

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

Console