Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <button type="button">Toggle grid</button>

<article class="s-post">
  <small>Jul 20, 2017</small>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloribus atque magnam cum laudantium animi eius minus odio porro cumque! <a href="#">Maxime laboriosam odio</a> expedita quo ducimus ipsum adipisci eos, a sunt!</p>
  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Iste qui laboriosam, libero animi ipsa quidem ea alias unde exercitationem vel culpa pariatur recusandae molestiae assumenda. Voluptatum, iure. Incidunt, esse reprehenderit!</p>
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/55867/pupper.jpg" alt="Pupper">
    <figcaption><strong>Pupper</strong><p>Soon to be doggo</p></figcaption>
  <p>Lorem ipsum dolor sit amet consectetur <a href="#">adipisicing elit</a>. Eos esse rem quos eaque architecto deserunt illo perferendis aliquam consectetur, assumenda illum unde non temporibus aspernatur perspiciatis tempore recusandae vitae magni?</p>
  <small><em>&ndash; <a href="https://codepen.io/reverendgeneral/">Bobby Showalter</a></em></small>
              html {
  background-color: lavender;
  box-sizing: border-box;
  color: #404040;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
  font-size: 1.25em;
  line-height: 1.5;
  padding: 1rem;

*::after {
  box-sizing: inherit;

.s-post {
  background-color: rgba(255, 255, 255, .75);
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(150,150,150, .5);
  margin: 0 auto;
  max-width: 60rem;
  padding: 1rem;

.s-post.grid {
  display: grid;
    [full-start] 1fr
    [main-start] minmax(0, 50ch) [main-end]
    1fr [full-end];

.s-post > *:first-child {
  margin-top: 0;

.s-post > *:last-child {
  margin-bottom: 0;

.s-post > * {
  grid-column: main;

.s-post h1 {
  color: rebeccapurple;

.s-post small {
  opacity: .5;

.s-post a {
  color: #2d1cfe;

.s-post figure {
  background-color: lavender;
  border: 4px solid indigo;
  border-radius: 3px;
  display: flex;
  flex-wrap: wrap;
  grid-column: full;
  margin: 1.5rem 1rem;

.s-post figure img {
  flex: 1 0 auto;
  max-width: 100%;
  object-fit: cover;

.s-post figure figcaption {
  color: rebeccapurple;
  flex: 1 1 11.391rem;
  padding: 1rem;

.s-post figure figcaption > *:last-child {
  margin-bottom: 0;

button {
  background-color: #dc3a00;
  border: 0;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(50, 50, 50, .25);
  color: white;
  display: inline-block;
  padding: .5em 1em;
  position: fixed;
  bottom: .5rem;
  right: .5rem;
  text-shadow: 0 1px 3px rgba(25, 25, 25, .25);
              const button = document.querySelector('button');

button.addEventListener('click', () => {
  let post = document.querySelector('.s-post');
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.