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

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

              
                <div class="wrapper">
  <div class="wide-column">
    <article class="card">
      <header>
        <h2>Balloon G-OPAW</h2>
      </header>

      <div class="image"><img src="https://assets.codepen.io/12005/balloons9_copy.jpg" alt="a balloon in the shape of a dog"></div>

      <div class="content">
        <p>This special shape balloon is a UK registered aircraft, and has flown at the Bristol International Balloon Fiesta. I took this photo however in Albuquerque after landing in a garden after a flight during the Balloon Fiesta there. </p>
      </div>

    </article>
  </div>
  <div class="narrow-column">
  <article class="card">
      <header>
        <h2>Balloon G-OPAW</h2>
      </header>

      <div class="image"><img src="https://assets.codepen.io/12005/balloons9_copy.jpg" alt="a balloon in the shape of a dog"></div>

      <div class="content">
        <p>This special shape balloon is a UK registered aircraft, and has flown at the Bristol International Balloon Fiesta. I took this photo however in Albuquerque after landing in a garden after a flight during the Balloon Fiesta there. </p>
      </div>

    </article>
  </div>
</div>
              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  display: block;
}

body {
  font: 1.2em Roboto, sans-serif;
}

.wrapper {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap:20px;
}

.card {
  border: 1px solid black;
  border-radius: 3px;
  display: grid;
  padding: 3px;
}

.card .image {
  border: 10px solid #000;
  border-radius: 3px;
}

.card .content {
  padding: 10px;
}

.card h2 {
  margin: 0;
  padding: 10px;
}

/* make the two grid items a containment context */
.wide-column,
.narrow-column{
  container-type: inline-size;
}

/* the card is placed as a child of the two grid items, displaying as one or two columns  */
@container (min-width: 700px) {
  .card {
    grid-template-columns: 1fr 2fr;
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 20px;
  }
  
  .card h2 {
    padding: 0;
    margin: .5em 0 0 0;
  }

  .card header {
    grid-row: 1;
    grid-column: 2;
  }

  .card .image {
    grid-row: 1 / 3;
    grid-column: 1;
  }

  .card .content {
    grid-column: 2;
    grid-row: 2;
    padding: 0 20px 20px 0;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console