css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Fluid Grid using text-align: justify</h1>

<!-- FLUID GRID -->

<ul id="Grid">
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li class="placeholder"></li>
</ul>

<!-- LEGEND -->

<p>Resize the grid to see how the elements reflow based on the new column-widths defined in the media queries.<br/>
  <strong>There is no need to ever define horizontal margins/floats/or clear-fixes.</strong></p>

  
<label>Placeholder/gap element*</label>
<label>Break element*</label>
  
<p><em>*These elements are visible only for demonstration purposes and should be hidden in production by removing the borders.</em></p>

<p>More info here: <a target="_blank" href="http://www.barrelny.com/blog/text-align-justify-and-rwd/">here</a></p>
            
          
!
            
              /* -- DEFAULTS -- */

div, ul, li{
  margin: 0;
  padding: 0;
  list-style-type: none;
}

/* -- FLUID GRID STYLES -- */

#Grid{
  margin-bottom: 40px;
  text-align: justify;
  font-size: 0.1px;
}

#Grid li{
  display: inline-block;
  background: #eee;
  width: 23%;
  padding-top: 23%; /* Used instead of height to give elements fluid, width-based height */
  margin-bottom: 2.5%;
}

#Grid:after{
  content: '';
  display: inline-block;
  width: 100%;
  border-top: 10px dashed #922d8d; /* Border added to make element visible for demonstration purposes */
}

#Grid .placeholder{
  padding: 0;
  border-top: 10px solid #922d8d; /* Border added to make element visible for demonstration purposes */
}

/* -- MEDIA QUERIES DEFINING RESPONSIVE LAYOUTS -- */

/* 3 COL */

@media (max-width: 800px){
  #Grid li{
    width: 31%;
    padding-top: 31%;
    margin-bottom: 3%;
  }
}

/* 2 COL */

@media (max-width: 600px){
  #Grid li{
    width: 48%;
    padding-top: 48%;
    margin-bottom: 4%;
  }
}

/* SINGLE COL */

@media (max-width: 400px){
  #Grid li{
    width: 100%;
    padding-top: 100%;
    margin-bottom: 5%;
  }
}


/* -- LEGEND STYLES (NOT PART OF GRID FRAMEWORK) -- */

h1{
  font: 600 20px "Helvetica Neue";
  text-align: right;
  text-transform: uppercase;
}

label{
  padding: 8px 15px;
  margin-bottom: 20px;
  display: block;
  font: 100 22px "Helvetica Neue"; 
  border-left: 10px solid #922d8d;
}

label:last-of-type{
  border-left: 10px dotted #922d8d;
}

p{
  font: 200 15px/1.5em "Helvetica Neue";
  max-width: 400px;
  margin-bottom: 30px;
  color: #333;
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console