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

              
                <body>
  <header>
    <h1>Real World Scenario Flexbox Example</h1>
    <p class="subhead">Common Design Pattern &bull; Equal Height Columns With A Grounded Button (Or&nbsp;Other&nbsp;Element)</p>
  </header>

  <section>
    <article>
      <h2>First Article</h2>

      <div>
        <p>Lorem ipsum dolor amet offal unicorn swag kitsch yr cliche neutra squid, cronut locavore deep v kinfolk fixie master cleanse. Meh wolf yr dreamcatcher, banh mi +1 hexagon. Humblebrag raclette irony everyday carry glossier single-origin coffee air plant. Tbh letterpress bicycle rights, synth bespoke fanny pack fixie selfies 8-bit succulents lomo. Messenger bag hella vexillologist, letterpress vegan fingerstache hammock everyday carry iPhone vice tbh +1 brooklyn authentic.</p>
      </div>

      <div class="button-wrapper">
        <button>Smile</button>
      </div>

    </article>

    <article>
      <h2>Second Article</h2>

      <div>
        <p>Yr meditation tacos shoreditch, put a bird on it bicycle rights butcher forage. Twee prism readymade activated charcoal, meggings bushwick you probably haven't heard of them narwhal craft beer 8-bit ramps plaid offal PBR&B franzen. Bitters artisan humblebrag mumblecore readymade brunch hot chicken umami narwhal iPhone. Normcore listicle photo booth pug butcher pork belly.</p>
        <p>Vexillologist migas four dollar toast, tacos unicorn semiotics echo park pitchfork freegan vegan sartorial taiyaki. Tumblr poke cloud bread unicorn pork belly cliche taxidermy food truck brunch vaporware distillery schlitz.</p>
      </div>

      <div class="button-wrapper">
        <button>Laugh</button>
      </div>

    </article>

    <article>
      <h2>Third Article</h2>

      <div>
        <p>La croix pok pok seitan, fanny pack woke kale chips tote bag. Narwhal put a bird on it la croix farm-to-table you probably haven't heard of them, hell of roof party salvia. Mumblecore man braid flexitarian activated charcoal keffiyeh slow-carb gluten-free kinfolk locavore dreamcatcher humblebrag DIY vexillologist yuccie distillery. Vexillologist migas four dollar toast, tacos unicorn semiotics echo park pitchfork freegan vegan sartorial taiyaki. Tumblr poke cloud bread unicorn pork belly cliche taxidermy food truck brunch vaporware distillery schlitz. Disrupt tumblr photo booth, irony hoodie knausgaard echo park. Gentrify banjo fixie messenger bag.</p>

        <p>Chicharrones vice four dollar toast keytar bushwick distillery man bun pinterest plaid. Celiac enamel pin ramps thundercats actually. Irony wayfarers chartreuse pinterest poutine green juice, vinyl biodiesel truffaut air plant poke fingerstache.</p>
      </div>

      <div class="button-wrapper">
        <button>Hug</button>
      </div>

    </article>
  </section>
</body>
              
            
!

CSS

              
                /* General Styles */

body {
  margin: 0;
  font: 18px "Helvetica Neue Light", Helvetica, Arial, sans-serif;
}
header {
  color: white;
  background: black;
  padding: 2rem;
}
p.subhead {
  font-size: 1.5rem;
  line-height: 2rem;
}
h1 {
  line-height: 2.5rem;
  font-weight: normal;
  letter-spacing: 0.15em;
}
h1,
p.subhead {
  text-align: center;
  color: white;
}
h2 {
  font-size: 1.5rem;
  font-weight: normal;
}

/* End General Styles */

article {
  display: flex;
  flex-flow: column;
  flex: 1 200px; /* Each flex item will first be given 200px of the available space. After that, the rest of the available space will be shared out according to the proportion units. */
  padding: 1rem;
  margin: 0.5rem;
  background: lightgray;
}

section {
  display: flex;
  flex-flow: row wrap; /* Responsive. Shorthand for direction and wrap. */
}

/* Uncomment to put the button in the center. 
.button-wrapper {
  text-align: center;
  width: 100%;
}
*/

button {
  border-radius: 5px;
  font-size: 1.25em;
  line-height: 1.5;
  margin: 0.5em;
  padding: 1% 5%;
}

button:hover {
  color: darkgray;
  background-color: white;
}

/* We only need to do this for landscape and larger devices. */
@media only screen and (min-width: 481px) {
  article div:nth-child(2) {
    /* Let the middle content
       grow to naturally push
       the button down. */
    flex: 1;
  }
  /* Previous way was to manipulate
     the last child div to ground
     the button towards the bottom.
  
     This works, but it's not as 
     elegant making the middle
     content (2nd div) grow which
     naturally pushes the button
     down towards the bottom.
  article div:last-child {
    flex: 1 100px;
    display: flex;
    align-items: flex-end; Ground the button .
    justify-content: left; 
  */
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console