Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>Grid with Quantity Queries</h1>
<ol class="listing listing--events">
  				<li class="listing__item listing__item--1 event event--future">
    							<a href="http://lanyrd.com/2015/web-sherpa-summit/">
      			<h3 class="listing__item__title event__title">Web Sherpa Summit</h3>
      	<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Online</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--2 event event--future">
    		<a href="http://uxim15.uie.com/">
      		<h3 class="listing__item__title event__title">UX Mobile Immersion</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Salt Lake City, UT USA</b>
      			</p>
  		  </a>
  		</li>
  <li class="listing__item listing__item--3 event event--future">
    		<a href="http://lanyrd.com/2015/convergese/">
      		<h3 class="listing__item__title event__title">Converge SE</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Columbia, SC USA</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--4 event event--future">
    		<a href="http://lanyrd.com/2015/bdconf/">
      		<h3 class="listing__item__title event__title">Breaking Development</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Nashville, TN USA</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--5 event event--future">
    		<a href="http://www.webdesignday.com/">
      		<h3 class="listing__item__title event__title">Web Design Day</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Pittsburgh, PA USA</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--6 event event--future">
    		<a href="http://lanyrd.com/2015/responsive-day-out-3/">
      		<h3 class="listing__item__title event__title">Responsive Day Out</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Brighton, England</b>
      </p>
    	</a>
		  </li>
  <li class="listing__item listing__item--7 event event--future">
    		<a href="http://lanyrd.com/2015/dcontentconf/">
      		<h3 class="listing__item__title event__title">Design/Content</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">August 2015</b>
        				<b class="event__location">Vancouver, BC Canada</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--8 event event--future">
    <a href="http://aneventapart.com/event/washington-dc-2015">
		      <h3 class="listing__item__title event__title">An Event Apart</h3>
			      <p class="listing__item__meta">
				        <b class="event__date">August 2015</b>
				        <b class="event__location">Washington, DC USA</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--9 event event--future">
		    <h3 class="listing__item__title event__title">TBA</h3>
    <p class="listing__item__meta">
      <b class="event__date">November 2015</b>
      <b class="event__location">New York, NY USA</b>
    			</p>
  		</li>
  <li class="listing__item listing__item--10 event event--future">
    		<h3 class="listing__item__title event__title">TBA</h3>
			    <p class="listing__item__meta">
      				<b class="event__date">November 2015</b>
      				<b class="event__location">Malmö, Sweden</b>
    			</p>
				  </li>
</ol>

<h1>Normal Grid</h1>
<ol class="listing listing--events">
  				<li class="listing__item listing__item--1 event">
    							<a href="http://lanyrd.com/2015/web-sherpa-summit/">
      			<h3 class="listing__item__title event__title">Web Sherpa Summit</h3>
      	<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Online</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--2 event">
    		<a href="http://uxim15.uie.com/">
      		<h3 class="listing__item__title event__title">UX Mobile Immersion</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Salt Lake City, UT USA</b>
      			</p>
  		  </a>
  		</li>
  <li class="listing__item listing__item--3 event">
    		<a href="http://lanyrd.com/2015/convergese/">
      		<h3 class="listing__item__title event__title">Converge SE</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">April 2015</b>
        				<b class="event__location">Columbia, SC USA</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--4 event">
    		<a href="http://lanyrd.com/2015/bdconf/">
      		<h3 class="listing__item__title event__title">Breaking Development</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Nashville, TN USA</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--5 event">
    		<a href="http://www.webdesignday.com/">
      		<h3 class="listing__item__title event__title">Web Design Day</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Pittsburgh, PA USA</b>
      			</p>
    		</a>
  		</li>
  <li class="listing__item listing__item--6 event">
    		<a href="http://lanyrd.com/2015/responsive-day-out-3/">
      		<h3 class="listing__item__title event__title">Responsive Day Out</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">June 2015</b>
        				<b class="event__location">Brighton, England</b>
      </p>
    	</a>
		  </li>
  <li class="listing__item listing__item--7 event">
    		<a href="http://lanyrd.com/2015/dcontentconf/">
      		<h3 class="listing__item__title event__title">Design/Content</h3>
      			<p class="listing__item__meta">
        				<b class="event__date">August 2015</b>
        				<b class="event__location">Vancouver, BC Canada</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--8 event">
    <a href="http://aneventapart.com/event/washington-dc-2015">
		      <h3 class="listing__item__title event__title">An Event Apart</h3>
			      <p class="listing__item__meta">
				        <b class="event__date">August 2015</b>
				        <b class="event__location">Washington, DC USA</b>
      			</p>
		    </a>
		  </li>
  <li class="listing__item listing__item--9 event">
		    <h3 class="listing__item__title event__title">TBA</h3>
    <p class="listing__item__meta">
      <b class="event__date">November 2015</b>
      <b class="event__location">New York, NY USA</b>
    			</p>
  		</li>
  <li class="listing__item listing__item--10 event">
    		<h3 class="listing__item__title event__title">TBA</h3>
			    <p class="listing__item__meta">
      				<b class="event__date">November 2015</b>
      				<b class="event__location">Malmö, Sweden</b>
    			</p>
				  </li>
</ol>
              
            
!

CSS

              
                body {
  padding: 1em;
}

.listing--events {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0 0 1em;
  padding: 0;
}
 
.event {
  background: rgb(26, 88, 18);
  color: rgb(249, 249, 249);
  text-shadow: 1px 1px 1px rgb(26, 88, 18);
  box-sizing: border-box;
  padding: 1.25rem;
  margin: 0 0 1.25rem;
  flex: 0 0 100%;
  position: relative;
  overflow: hidden;
}

.event a {
  color: white;
}
 
@media only screen and (min-width: 28.75em) {
  
  .event {
    flex: 0 0 calc( 50% - 1.25rem / 2 );
    /* 20px gap divided by 2 events per row */
    margin-left: 1.25rem;
  }
  
  /* Remove left margin for row starters */
  .event:nth-child(odd) {
    margin-left: 0;
  }
  
  /* Reset margins on "future" events
     & remove the correct one */
  .event--future:nth-child(odd) {
    margin-left: 1.25rem;
  }
  .event--future:nth-child(even) {
    margin-left: 0;
  }
  
  /* Quantity Query - when more than 1,
     make the first span both columns  */
  .event--future:nth-last-child(n+1):first-child {
    flex: 0 0 100%;
    font-size: 1.5em;
    margin-left: 0;
  }

}
 
@media only screen and (min-width: 43.125em) {

  /* 1/3 width with a 20px gutter (fudged) */
  .event {
    flex: 0 0 calc( 100% / 3 - 0.875rem );
  }
  
  /* Reset margins */
  .event:nth-child(even),
  .event:nth-child(odd) {
    margin-left: 1.25rem;
  }
  /* Normal Grid margin removal */
  .event:nth-child(3n+1) {
    margin-left: 0;
  }

  /* Quantity Query - when more than 2,
     make the first 2 go 50%  */
  .event--future:nth-last-child(n+2):first-child, 
  .event--future:nth-last-child(n+2):first-child + .event--future {
    flex: 0 0 calc( 50% - 1.25rem / 2  );
    font-size: 1.5em;
  }
  
  /* Margin reset */
  .event--future:nth-child(3n+1) {
    margin-left: 1.25rem;
  }
  
  /* Quantity + nth */
  .event--future:nth-last-child(n+2):first-child ~ .event--future:nth-child(3n) {
    margin-left: 0;
  }
  
}
              
            
!

JS

              
                
              
            
!
999px

Console