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.

            
              <header class="header">
  <h1 class="header__title">Content-Aware CTA</h1>
  <a href="http://praliedutzel.com/content-aware-call-to-action/" target="_blank">Read the Article</a>
</header>

<ul class="grid">
  <li class="grid__item"></li>
  <li class="grid__item"></li>
  <li class="grid__item"></li>
  <li class="grid__item"></li>
  <li class="grid__item grid__cta">
    <a href="http://praliedutzel.com/writings/" target="_blank" class="grid__link">Read More Articles</a>
  </li>
</ul>

<button type="button" id="add-grid" class="button">Add Grid Item</button>
<button type="button" id="remove-grid" class="button">Remove Grid Item</button>
            
          
!
            
              .grid {
  margin: 0;
  padding: 0;
  list-style: none;
  
  .flexbox & {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
  }
  
  &:after {
    content: "";
    display: table;
    clear: both;
  }
}

.grid__item {
  background-color: #232439;
  width: calc(100% - 2em);
  margin: 1em;
  padding: 2em 1em;
  display: block;
  float: left;
  
  .flexbox & {
    float: none;
  }
}

.grid__link {
  display: block;
  color: #fff;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 0.3s ease-in-out;
  
  &:hover,
  &:focus {
    color: #6ddce5;
  }
}


@media screen and (min-width: 40em) and (max-width: 64em) {
  .grid__item { width: calc(50% - 2em); }
  
  .grid__cta { width: calc(100% - 2em); }
  .grid__cta:nth-of-type(2n) { width: calc(50% - 2em); }
}  
  
@media screen and (min-width: 64em) {
  .grid__item { width: calc(33.333% - 2em); }
  
  .grid__cta { width: calc(100% - 2em); }
  .grid__cta:nth-of-type(3n) { width: calc(33.333% - 2em); }
  .grid__cta:nth-of-type(3n+2) { width: calc(66.666% - 2em); }
}


// Styles for the add and remove buttons
.button {
  background-color: transparent;
  margin: 1em;
  padding: 1em;
  display: inline-block;
  cursor: pointer;
  border: 2px solid #6ddce5;
  border-radius: 0;
  outline: none;
  color: #6ddce5;
  font-weight: bold;
  text-transform: uppercase;
  transition: all 0.3s ease-in-out;
  
  &:hover,
  &:focus {
    background-color: #6ddce5;
    color: #fff;
  }
}


// The code below this point is used for styling the demo
@at-root {
  *, *:before, *:after { box-sizing: border-box; }
  
  body {
    background-color: #f9f9f9;
    margin: 0;
    padding: 0;
    font-family: "Open Sans", Helvetica Neue, Helvetica, Arial, sans-serif;
    text-align: center;
  }

  .header {
    background-color: #232439;
    padding: 4rem 2rem;
    text-align: center;
    
    a {
      margin-top: 1rem;
      display: block;
      color: #6ddce5;
      font-size: 0.85rem;
      text-decoration: none;
    }
  }

  .header__title {
    margin: 0;
    color: #fff;
    font-weight: 300;
  }
}
            
          
!
            
              $('#add-grid').on('click', function() {
  $('.grid').prepend( '<li class="grid__item"></div>' );
});


$('#remove-grid').on('click', function() {
  $('.grid__item').first().remove();
});
            
          
!
999px
Loading ..................

Console