Pen Settings

HTML

CSS

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.

+ 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="page-wrap">
  
  <h1>Make This Responsive</h1>
  
  <p>While maintaining the heirarchy of importance.</p>
  
  <article class="main-story">
    
    <img src="https://f.cl.ly/items/2e3c2a1Z0D1H3u0W2K12/shera.jpg" alt="Sha Ra Rocking"/>
    
    <div class="story-intro">
      <h1>Most Important Story</h1>
      <p>This article has the most visual weight: <a href="http://nebezial.deviantart.com/art/she-ra-115867096">image source</a>.</p>
    </div>
    
  </article>
  
  <section class="sub-stories">
    
    <article class="sub-story first">
      <img src="http://placekitten.com/250/350"/>
      <div class="story-intro">
        <h2>Less Important Story</h2>
        <p>This story has less visual weight.</p>
      </div>
    </article>
    
    <article class="sub-story">
      <img src="http://placecage.com/250/350"/>
      <div class="story-intro">
        <h2>Less Important Story</h2>
        <p>This story has less visual weight.</p>
      </div>
    </article>
    
    <article class="sub-story last">
      <img src="http://placebear.com/250/350"/>
      <div class="story-intro">
        <h2>Less Important Story</h2>
        <p>This story has less visual weight.</p>
      </div>
    </article>
    
  </section>
  
</div>
              
            
!

CSS

              
                @import "compass/css3";

@import url(https://fonts.googleapis.com/css?family=Open+Sans);

@mixin breakpoint($point) {
  @if $point == papa-bear {
    @media (max-width: 48em) { @content; }
  }
  @else if $point == mama-bear {
    @media (max-width: 38em) { @content; }
  }
  @else if $point == baby-bear {
    @media (max-width: 28em)  { @content; }
  }
}

* {
  box-sizing: border-box; 
  transition: all 0.2s ease-out;
}

body {
  background: url(http://subtlepatterns.subtlepatterns.netdna-cdn.com/patterns/kindajean.png);
  font-family: "HelveticaNeue-Light","Helvetica Neue Light","Helvetica Neue","Helvetica","Arial","Lucida Grande",sans-serif;
}

.page-wrap {
  width: 100%;
  max-width: 50em;
  margin: 1.25em auto;
  padding: 1.25em;
}

.page-wrap > h1  {
  margin-bottom: 0;
  border-left: 10px solid crimson;
  padding: 0 0 0 0.25em;
}

.page-wrap > p {
  font-size: 1.2em;
  margin-bottom: 1.5em;
}

.main-story {
  position: relative;
  margin: 0 0 1em 0;
}

img {
  display: block; 
  height: auto;
  width: 100%;
  box-shadow: 0 5px 3px -2px rgba(0,0,0,0.35);
}

a {
  color: crimson;
  
  &:hover {
    color: red;
  }
}

.story-intro {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(20, 0, 0, 0.85); 
  padding: 1em;
  color: white;
  
  h1 {
    font-size: 2.2em; 
  }
  
  p {
    margin: 0;
  }
}

h1 {
  font-size: 4em;
  position: relative;
}

h1, h2 {
  margin: 0 0 0.6em 0;
  text-transform: uppercase;
  font-weight: normal;
  font-family: 'Open sans', sans-serif;
}

.sub-stories {
  overflow: hidden;
  margin: 0 0 1.25 0;
}

.sub-story {
  float: left;
  width: 32%;
  margin: 1%;
  position: relative;
  font-size: 80%;
}

.first { margin-left:  0; }
.last  { margin-right: 0; }

@include breakpoint(papa-bear) { 
  .story-intro { font-size: 0.9em; }
  .page-wrap > h1 {
    font-size: 3.5em;
  }
}

@include breakpoint(mama-bear) {
  .sub-story {
    width: 49%;
    font-size: 90%;
    
    &:nth-of-type(even) {
      margin: 0 0 1.25em 1%;
    }
    
    &:nth-of-type(odd) {
      margin: 0 1% 1.25em 0;
    }
    
    &:nth-of-type(odd).last {
      margin: 0 auto;
      float: none; 
      clear: both;
    }
  }

  .page-wrap > h1 {
    font-size: 2.5em;
  }
  
  .main-story .story-intro { 
    position: relative; 
    margin: 0.6em auto;
    box-shadow: 
      0 5px 3px -2px rgba(0,0,0,0.3),
      inset 0 1px rgba(255,255,255,0.3);
    background: rgb(50, 50, 50);
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 3px;
    color: #fff;
    text-shadow: 0 -1px rgba(0,0,0,0.4);
    
    &:after,
    &:before {
      content: '';
      position: absolute;
      z-index: 2;
      background: silver;
      border: 1px solid rgba(0,0,0,0.2);
      box-shadow: 
        inset 0 2px 1px rgba(255,255,255,1),
        inset 0 -3px 2px rgba(0,0,0,0.3),
        0 0 3px rgba(0,0,0,0.2);
      width: 5px;
      height: 40px;
      top: -31px;
      right: 14px;
      display: block;
      border-radius: 3px;
    }
    
    &:before {
      left: 14px;
    }
  }

  .main-story h1 {
    &:after,
    &:before {
      content: "";
      position: absolute;
      border-radius: 50%;
      width: 13px;
      height: 13px;
      right: -3px;
      top: -12px;
      background: white;
      box-shadow: 
        inset 0 2px 1px rgba(0,0,0,0.4),
        0 -40px white;
    }
  
    &:before {
      left: -3px;
    }
  }
}

@include breakpoint(baby-bear) {  
  
  .page-wrap > h1 {
    font-size: 1.8em;
  }
  
  .main-story h1 {
    font-size: 1.8em;
  }
  
  .sub-story h1 {
    font-size: 80%;
  }
  
  .page-wrap .sub-story {
    float: none;
    margin: 20px auto;
    width: 100%;
    max-width: 300px;
  }
}
              
            
!

JS

              
                /*

Base changes
============

1. The page-wrap has a max-width of 800px and a width of 100%

2. The sub stories has a width of 33% until the 2nd breakpoint where it goes to 50% (2 rows)

First Breakpoint (48em)
=======================

1. Font-size is recalculated.

Second breakpoint (38em)
========================

1. The main story caption gets out of the picture

2. The sub stories now have 50% width
   * If there is an odd number of substories, the last one is centered on its own row.

Third breakpoint (28em)
=======================

1. The sub stories are now horizontally centered, one per row

*/
              
            
!
999px

Console