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

              
                <main class="D R">
  <article>
   <h1>Article with a Headline</h1>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/10558/manwithacamera.jpg" alt="test image" />
    <p> Nullam bibendum hendrerit augue, sed tempus odio sagittis nec. Ut ipsum lorem, scelerisque ac vestibulum et, tincidunt eget urna. Phasellus pellentesque nec urna id elementum. Maecenas a urna metus. Vivamus ac euismod ante. Vivamus ut risus porttitor, porttitor ligula a, maximus risus. Donec maximus vulputate mauris, vel placerat diam interdum eu. Nam tempus diam eget blandit efficitur. Etiam sed porta nisi. Donec sit amet sapien in est pellentesque sollicitudin. Donec nec erat efficitur, efficitur purus vel, vehicula odio. Fusce eget placerat massa, vel porta lacus. Proin consectetur finibus lacinia. </p>
  </article>

  <aside>
    <h2>Sidebar Headlinnne</h2>
    <p>Lorem ipsum dolor sit amet consectetur adipiscing, elit inceptos nunc et litora, cras class id morbi viverra. Leo in hac vel sed molestie fringilla fusce orci, dis nibh pharetra quisque inceptos interdum tortor, porta parturient varius magna curae feugiat vestibulum egestas, suscipit facilisi accumsan torquent aptent lobortis. Non dictum feugiat himenaeos consequat per odio ante porta eget senectus, ac accumsan ligula laoreet vivamus sociis mollis habitasse magna, felis massa dis id malesuada donec ut pulvinar iaculis.</p>
  </aside>
  <footer></footer>
  <footer></footer>
</main>
              
            
!

CSS

              
                * { box-sizing: border-box; } 
h1, h2, p, img { border: solid 8px #c429c4; }
main { border: solid 8px #20a0ca; font-family: "Avenir Next"; margin: 2rem; }
article, aside { border: solid 8px #ffb53e; }
h1 { font-family: "Avenir Next Condensed"; font-weight: 200; font-size: 3.6rem; line-height: 1.1; margin: 0 0 0.5em; }
h2 { text-align:center; margin-top: 0; }

.A {
  display: grid;
  grid-template-columns: 3fr 1fr;
  grid-gap: 0 2rem;
  img {
    width: 300px;
  }
  footer:nth-of-type(1)::after { content: '3fr'; }
  footer:nth-of-type(2)::after { content: '1fr'; }
}

.B {
  display: grid;
  grid-template-columns: 3fr 300px;
  grid-gap: 0 2rem;
  img {
    width: 300px;
  }
  footer:nth-of-type(1)::after { content: '3fr'; }
  footer:nth-of-type(2)::after { content: '300px'; }
}

.C {
  display: grid;
  grid-template-columns: 3fr 300px;
  grid-gap: 0 2rem;
  img {
    width: 100%;
  }
  footer:nth-of-type(1)::after { content: '3fr'; }
  footer:nth-of-type(2)::after { content: '300px'; }
}

.D {
  display: grid;
  grid-template-columns: 3fr 300px;
  grid-gap: 0 2rem;
  img {
    width: 100%;
    height: 50vh; 
    object-fit: cover;
    object-position: 50% 40%;
  }
  footer:nth-of-type(1)::after { content: '3fr'; }
  footer:nth-of-type(2)::after { content: '300px'; }
}

.R {
  border: none;
  h1, h2, p, img { border: none; }
  h2 { font-weight: normal; }
  article, aside { border: none; }
  footer { display: none; }
}

footer {
  text-align: center;
  background: black;
  color: yellow;
  padding: 0.2rem;
  font-size: 1.8rem;
  font-weight: bold;
}
footer:nth-of-type(1) {
  grid-area: 1 / 1 / 2 / 2;
  align-self: center;
}
footer:nth-of-type(2) {
  grid-area: 1 / 2 / 2 / 3;
  align-self: center;
}
              
            
!

JS

              
                
              
            
!
999px

Console