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

              
                <header>
  <div class="row">
    <div class="small-12 col">
      <h1>Cake Shop</h1>
    </div>
  </div>
</header>
<div class="row">
  <nav class="small-12 medium-shrink xxlarge-2 col">
    <ul class="block-grid medium-vertical">
      <li><a href="#">Home</a></li>
      <li><a href="#">About</a></li>
      <li><a href="#">Clients</a></li>
      <li><a href="#">Contact Us</a></li>
    </ul>
  </nav>  
  <aside class="small-hidden large-shrink xxlarge-2 col">
    <p>Sections</p>
    <ol>
      <li><strong>Section 1</strong>
        <ol>
          <li>Section 1.1</li>
        </ol>
      </li>      
      <li>Section 2</li>
      <li>Section 3</li>
    </ol>  
  </aside>
  <main class="small-12 medium-auto col">
    <article>
      <h1>Main Heading of the article</h1>
      <p>Introducing of the essay goes here.</p>
      <h2>Section 1—Photos</h2>
      <p>You’ll find a couple of images in the following that shows the flexbox-based block-grid system.</p>
      <div class="block-grid small-up-to-2 medium-up-to-3">
        <figure>
          <img src="//via.placeholder.com/300x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/350x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/700x400" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/500x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/500x600" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/300x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/300x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
        <figure>
          <img src="//via.placeholder.com/300x300" alt="placeholder image" />
          <figcaption>This is a placeholder.</figcaption>
        </figure>
      </div>
      <h3>1.1 Sub section</h3> 
      <p>This is a paragraph of section 1.1. It’s the sub-section that conclude the section 1.</p>
      <h2>2. Section 2</h2>
      <p>We create more sections. An essay usually contains more than 1 section. This is the reason we put section 2 here.</p>
      <h2>3. Summary</h2>
      <p>This section summerize the entire article.</p>
    </article>
  </main>
  <div class="advertisement row">
    <div class="small-hidden xlarge-shrink col">
      <img src="//via.placeholder.com/160x600&text=ad." alt="Advertisement" />
    </div>
  </div>
</div>  
<footer>
  <div class="row">
    <div class="small-12 col">
      CC0 Do anything license.
    </div>
  </div>
</footer>
              
            
!

CSS

              
                /* Border box */
* {
  box-sizing: border-box;
}

img {
  max-width: 100%;
}

/* Grid */
.row {
  /* if you need a largest width */
  width: 1920px;
  max-width: 100%;
  margin: 0 auto;

  display: flex;
  flex-wrap: wrap;
}
.row .row {
  margin-left: -10px;
  margin-right: -10px;
  width: auto;
  max-width: none;
}

.col {
  padding: 0 10px;
  min-width: 0;
  
  border: 1px dashed LIGHTGRAY;
}

$columns-count: 12;
$screen-sizes: small medium large xlarge xxlarge;
$breakpoints: 0 500px 1000px 1200px 1600px;
@for $i from 1 through length($screen-sizes) {
  @media screen and (min-width: nth($breakpoints, $i)){
    .#{nth($screen-sizes, $i)}-vertical { flex-direction:column; }
    .#{nth($screen-sizes, $i)}-horizontal { flex-direction:row; }
    .#{nth($screen-sizes, $i)}-hidden { display: none; }
    .#{nth($screen-sizes, $i)}-auto   { display: block; flex: 1}
    .#{nth($screen-sizes, $i)}-shrink { display: block; flex: 0 1 auto}
    @for $j from 1 through $columns-count {
      .#{nth($screen-sizes, $i)}-#{$j} {
        display: block; 
        flex: 0 1 calc( 100% / #{$columns-count} * #{$j} );
      }
    }    
  }  
}

/* Block grid */
.block-grid {
  display: flex;
  flex-wrap: wrap;
}
.block-grid > * { flex: 1; }
@for $i from 1 through length($screen-sizes) {
  @media screen and (min-width: nth($breakpoints, $i)){   
    @for $j from 2 through 10 {
      .block-grid.#{nth($screen-sizes, $i)}-up-to-#{$j} > * {
        flex: 0 1 calc( 100% / #{$j} );
      }
    }
  }
}

/* Individual element’s style */
figure {
  padding: 5px;
  
  img {
    width: 100%;
    height: 200px;
    object-fit: cover;
  }
  
  figcaption {
    text-align: center;
  }
}

/* Visual styles */
body {
  background: LIGHTYELLOW;
  font-size: 14pt;
  line-height: 1.2em;
  font-family: Gill Sans, sans-serif;
  font-weight: 300;
}
h1, h2, h3 {
  font-weight: 600;
}
h2 {
  margin: 1em 0 0.5em;
}
strong{
  font-weight: bold;
}
p {
  margin: 0.5em 0;
}
header {
  line-height: 3em;
  background: MOCCASIN;
}
article {
  padding-top: 1em;
}
nav {
  width: 150px;
}
nav li {
  
  a {
    text-decoration: none;
    color: CRIMSON ;
    padding: 5px 15px 5px 5px;
    margin-left: -5px;
    display: block;
    
    &:hover {
      background: CRIMSON;
      color: WHITE;
    }
  }
}
footer {
  font-size: 0.7em;
  padding: 2em 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console