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

              
                <h2>1. Super Centered</h2>
<div id="super-centered" class="super-centered">
  <p contenteditable>This is super centered</p>
</div>
<h2>2. The Deconstructed Pancake</h2>
<div id="pancake" class="pancake">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>
<h2>3. Sidebar Says ... </h2>
<div id="a-sidebar" class="a-sidebar">
  <div>minmax ( 150px, 25% )</div>
  <div>Conetent here.</div>
</div>
<h2>4. Pancake Stack</h2>
<div id="pancake-stack" class="pancake-stack">
  <div>Header</div>
  <div>Content</div>
  <div>Footer</div>
</div>
<h2>5. Holy Grail Layout</h2>
<div id="holy-grail" class="holy-grail">
  <div class="header">Header</div>
  <div class="l-sidebar">Left sidebar</div>
  <div class="content">Main Content</div>
  <div class="r-sidebar">Right sidebar</div>
  <div class="footer">Footer</div>
</div>
<div>
  <p>These codes are retrieved from YouTube Channel <a href="https://www.youtube.com/watch?v=qm0IfG1GyZU">Google Chrome Developers</a></p>
</div>
              
            
!

CSS

              
                .super-centered {
  background: #335522;
  color: #fff;
  display: grid;
  place-items: center;
}

.pancake {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.pancake div {
  height: 50px;
  text-align: center;
  background: #773355;
  color: #fff;
  flex: 1 1 150px;
/*   flex: 0 1 150px; */
  margin: 5px;
}

.a-sidebar {
  display: grid;
  grid-template-columns: minmax( 150px, 25% ) 1fr;
}

.a-sidebar div {
  padding: 16px;
}
.a-sidebar div:first-child {
  background: #227799;
  color: #fff;
}

.a-sidebar div:last-child {
  background: #997722;
  color: #fff;
}

.pancake-stack {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.pancake-stack div {
  padding: 1em;
}

.pancake-stack div:first-child {
  background: #cc99aa;
}

.pancake-stack div:nth-child(2) {
  background: #99ccaa;
}

.pancake-stack div:last-child {
  background: #aa99cc;
}

.holy-grail {
  display: grid;
  grid-template: auto 1fr auto / auto 1fr auto;
}
.holy-grail div {
  padding: 1em;
}
.holy-grail .header {
  background: #eeccaa;
  grid-column: 1/4;
}

.holy-grail .l-sidebar {
  background: #eeaacc;
}

.holy-grail .content {
  background: #ccaaee;
}

.holy-grail .r-sidebar {
  background: #aaeecc;
}

.holy-grail .footer {
  background: #aaccee;
  grid-column: 1/4;
}

              
            
!

JS

              
                
              
            
!
999px

Console