cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

            
              <div class="column">
  <h2>Image and text balance using flexbox and background images</h2>
<figure class="flex">
  <div></div>
  <div>
  <h3>Aloe polyphylla Schönland ex Pillans</h3>
  <p>Endangered native of the Maluti Mountains in Lesotho, Africa. Grows in rock crevices at high altitudes. Only alpine member of the genus Aloe.
Threats to populations of spiral aloe include
overgrazing, unsustainable harvesting by plant enthusiasts and people interested in its medicinal properties, and increasing rarity of its pollinator, the Malachite Sunbird.</p>
  </div>
</figure>

<figure class="flex">
  <div></div>
  <div>
  <h3>Ommatoiulus rutilans</h3>
  <p>Its shape and color have earned it the name of Wireworm. It differs clearly from a worm by having a rigid body and protected by a hard layer of chitin and mineral salts.
Easy to observe in humid places, among the leaf litter, wood.</p>
  </div>
</figure>
</div>
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Ubuntu:400,700');
* {
  box-sizing: border-box;
}
body { 
  min-height: 100vh;
  font-family: Ubuntu, sans-serif;
  margin: 2rem;
  background-color: hsl(250,10%,55%);
}
.flex {
  margin: 0;
  display: flex;
  border: 5px solid #333;
  background-color: #fff;
  margin-bottom: 2rem;
}
/* optional: alternately flips module layout 
.flex:nth-child(odd) {
  flex-direction: row-reverse;
}
*/
.flex div:first-child {
  flex: 1;
  background-size: cover;
  background-position: center;
}
.flex:first-of-type div:first-child {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/aloe-polyphylla-2x.jpg");
}
.flex:last-of-type div:first-child {
  background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/4273/wire-worm.jpg");
}
.flex div:last-child {
  margin: 2rem;
  flex: 2;
}
.flex h3 {
  font-size: 1.5rem;
  margin-top: 0;
  font-weight: 400;
}
.flex p {
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 400;
}
.flex p:last-of-type {
  margin-bottom: 0;
}
.column {
  width: 80%;
  margin: 0 auto;
  max-width: 700px;
}
@media all and (max-width: 600px) {
  body { margin: 0; }
  // .flex div { flex: 1 !important; } optional: equalizes the visual "weight" of the photo and description
}
@media all and (max-width: 450px) {
  h2 {
    margin: 1rem;
  }
  .flex {
    border: 0;
    margin: 0;
    border-bottom: 2px solid #333;
  }
  .flex div:last-child {
    margin: 1rem;
  }
  .column {
    width: 100%;
  }
}
@media all and (max-width: 400px) {
  .flex { flex-direction: column; } 
  .flex div:first-child {
    min-height: 200px;
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console