cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

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
Loading ..................

Console