Pen Settings

HTML

CSS

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

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

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.

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

              
                <div class="grid-container">
  <div class="grid-item gi-1">1</div>
  <div class="grid-item gi-2">2</div>
</div>
              
            
!

CSS

              
                /* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  padding: 2%;
}

/* READ THIS:
    
Since we have set box-sizing to "border-box" on all HTML elements (see top of stylesheet), this means that the sum of the inner content, padding, and border will equal the total width and height of the item.

We set the border to 5px on all sides.  This means that the border takes up 10px of space in both the height and width directions.  Therefore, the total "available space" for grid items in this container is 300px in both directions.

310px - (5px + 5px) = 300px

Remember this as we go through the tutorial.
*/
.grid-container {
  width: 310px;
  height: 310px;
  border: 5px solid #212226;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  grid-template-columns: repeat(8, 1fr);
  justify-items: center;
  align-items: center;
}

.gi-1 {
  color: #1E4040;
  background-color: #71D99E;
  grid-row-start: 2;
  grid-row-end: 6;
  grid-column-start: 2;
  grid-column-end: 6;
  width: 120px;
  height: 120px;
}

.gi-2 {
  color: #71D99E;
  background-color: #3A8C7D;
  grid-row-start: 7;
  grid-row-end: 9;
  grid-column-start: 2;
  grid-column-end: 4;
  width: 45px;
  height: 45px;
}

/* 
Basic grid item styles.  By using Flexbox, we can center the numbers in each grid item for aesthetic purposes.

You should be comfortable with these.  If you aren't, please go back and take my basic CSS and Flexbox tutorials.

Basic CSS - https://bit.ly/39TbwrZ 
Flexbox - https://bit.ly/3mcK9Oe 
*/
.grid-item {
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
              
            
!

JS

              
                
              
            
!
999px

Console