Pen Settings



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


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


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.


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.


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


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

body {
  padding: 2%;

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, 30px);
  grid-template-columns: repeat(8, 30px);

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

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 - 
Flexbox - 
.grid-item {
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;