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>
  <div class="cards">
    <div class="card">
      <div class="card-inner">
        <div class="content">
          <h3>Jingle Bells</h3>

          <p>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh, what fun it is to ride<br>
            In a one-horse open sleigh, hey!<br>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh what fun it is to ride<br>
            In a one-horse open sleigh
          </p>
        </div>

        <img src="https://assets.codepen.io/144736/pexels-digital-buggu-365069.jpg" alt="" />
      </div>
    </div>
    <div class="card">
      <div class="card-inner">
        <div class="content">
          <h3>Jingle Bells</h3>

          <p>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh, what fun it is to ride<br>
            In a one-horse open sleigh, hey!<br>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh what fun it is to ride<br>
            In a one-horse open sleigh
          </p>
        </div>

        <img src="https://assets.codepen.io/144736/pexels-digital-buggu-365069.jpg" alt="" />
      </div>
    </div>
    <div class="card">
      <div class="card-inner">
        <div class="content">
          <h3>Jingle Bells</h3>

          <p>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh, what fun it is to ride<br>
            In a one-horse open sleigh, hey!<br>
            Jingle bells, jingle bells<br>
            Jingle all the way<br>
            Oh what fun it is to ride<br>
            In a one-horse open sleigh
          </p>
        </div>

        <img src="https://assets.codepen.io/144736/pexels-digital-buggu-365069.jpg" alt="" />
      </div>
    </div>
  </div>
</main>



 
              
            
!

CSS

              
                :root {
  --gray: oklch(30% 0 0);
  --white: oklch(100% 0 0);
  --green: oklch(0.56 0.16 134.58);
  --red: oklch(0.56 0.26 28.58);
}

.cards {
  --card-size: s;
  
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: 71rem;
}

@container style(--card-size: s) {
  .card-inner {
    --card-max-width: 18rem;
    --card-padding: 1.2rem;
  }
}

@container style(--card-size: l) {
  .card-inner {
    --card-max-width: 33rem;
    --card-padding: 1.6rem;
  }
}

@container style(--card-theme: dark) {
  .card-inner {
    --card-background: var(--gray);
    --card-color: var(--white);
  }
}

@container style(--card-theme: colorful) {
  .card-inner {
    --card-background: var(--green);
    --card-color: var(--white);
    --card-border: var(--red);
  }
}

.card {
  --card-padding: 1.2rem;
  --card-max-width: 23rem;
  
  width: fit-content;
}

.card-inner {
  background-color: var(--card-background);
  border: 8px ridge var(--card-border);
  box-shadow: 0 0 7px 3px oklch(0% 0 0 / 10%);
  color: var(--card-color);
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  max-width: var(--card-max-width);
  position: relative;
}

.card h3 {
  font-size: 1.4em;
  margin-block: 0;
}

.card h3 a {
  color: initial;
  text-decoration: initial;
}

.card img {
  max-width: 100%;
  order: -1;
}

.card .content {
  padding: var(--card-padding);
}

.card :last-child {
  margin-block-end: 0;
}

















style[contenteditable] {
  display: block;
  border: 1px solid;
  padding: 1em;
  max-width: 30rem;
  font-family: monospace;
  white-space: pre;
  overflow: auto;
  background-color: oklch(80% 0 0);
  color: oklch(0% 0 0);
  margin-block-end: 2rem;
}

body {
  font-family: -apple-system,blinkmacsystemfont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
}

              
            
!

JS

              
                
              
            
!
999px

Console