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 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.

Quick-add: + add another resource

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.

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="grid">
<div class="item">
  <h2>Basketball</h2>
  <p>Basketball is a non-contact sport played on a rectangular court.</p>
</div>
<div class="item">
  <h2>Team sport</h2>
  <p>Most often played as a team sport with five players on each side.</p>
</div>
<div class="item">
  <h2>Objective</h2>
  <p>The objective is to shoot a ball through a hoop that is mounted to a backboard at each end of the court. </p>
</div>
<div class="item">
  <h2>Creation</h2>
  <p>The game was invented in 1891 by Dr. James Naismith.</p>
</div>
<div id="hero" class="item">
  <h2>An outdoor basketball net</h2>     
</div>
</div> <!-- /l-grid -->
<div class="main">
<p class="credit">All text and images from Wikipedia.</p>
 </div> <!-- /l-main -->
            
          
!
            
              * { 
  box-sizing: border-box;
}

.grid {
  padding: 1em;
  display: grid;
  grid-gap: 1em;
  @media screen and (min-width: 24em) {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 16em 16em 16em;
  }
  @media screen and (min-width: 48em) {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 16em 16em;
  }
}

.item { 
  // first, set all cells last in order 
  @media screen and (max-width: 24em) { order:3; }
  padding: 1em;
  background: #ccc;
}

.item:nth-child(1) {
  // secondly, set the first cell back to first in order
  @media screen and (max-width: 24em) { order:1; }
}

#hero { 
  // for small and medium size screens this cell will be second in order (which is actually the last item in the document)
  @media screen and (max-width: 24em) { order:2; }
  @media screen and (min-width: 24em) {
    grid-column-start: 1;
    grid-column-end: span 2;
  }
  @media screen and (min-width: 48em) {
    grid-column-start: 2;
    grid-column-end: span 2;
  }
  background-image: url(https://upload.wikimedia.org/wikipedia/commons/4/4e/Basketball_Goal.jpg);
  background-size:cover;
  background-position: center;
}

.main {
  padding: 1em;
}

.credit {
  font-size: 90%;
  color: gray;
}
            
          
!
999px
Loading ..................

Console