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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <article class="recipe">
  <header>
    <h1>Chris' Four-Bean Chili</h1>
    <div id="campfire">
      <div id="logs">
        <div></div>
        <div></div>
      </div>
      <div id="flames">
        <div></div>
        <div></div>
        <div></div>
      </div>
    </div>
  </header>
    
  <div class="recipe-text">
    <div class="intro clearfix">
      <h2>We're gonna make ...</h2>
      <img class="preview-img" src="https://images-gmi-pmc.edge-generalmills.com/8af00f36-5883-4476-9192-ba5c7e4cf540.jpg">
      <p>My grandpappy used to make this chili over the campfire under the Texas stars. The secret ingredient was a little squeeze of scorpion venom in the pot, which made it poisonously good.</p>
    </div>
    
    <div class="ingredients clearfix">
    <h2>What you'll need</h2>
    <ul>
      <li>
        <input type="checkbox" class="recipe-check" id="bison"> <label for="bison"><span></span><strong>1lb</strong>
        ground bison</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="onion"> <label for="onion"><span></span><strong>1 cup</strong>
        diced onion</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="jalapeno"> <label for="jalapeno"><span></span><strong>4</strong>
        diced jalepeños</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="beans"> <label for="beans"><span></span><strong>1 cup</strong>
        black beans</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="nbeans"> <label for="nbeans"><span></span><strong>1 cup</strong>
        great northern beans</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="kbeans"> <label for="kbeans"><span></span><strong>1 cup</strong>
        kidney beans</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="pbeans"> <label for="pbeans"><span></span><strong>1 cup</strong>
        pinto beans</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="garlic"> <label for="garlic"><span></span><strong>4 cloves</strong>
        garlic</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="chili"> <label for="chili"><span></span><strong>2 tbsp</strong>
        mexican chili powder</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="salt"> <label for="salt"><span></span><strong>2 tsp</strong>
        salt</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="pepper"> <label for="pepper"><span></span><strong>2 tsp</strong>
        ground pepper</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="cayenne"> <label for="cayenne"><span></span><strong>1 tsp</strong>
        cayenne</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="tomatoes"> <label for="tomatoes"><span></span><strong>28oz</strong>
        smushed tomatoes</label>
      </li>
      <li>
        <input type="checkbox" class="recipe-check" id="beef"> <label for="beef"><span></span><strong>3 cups</strong>
        beef broth</label>
      </li>
    </ul>
      
    <div class="calculate">
      <p>
        Please checkmark all the ingredients you have. Anything missing? Go and buy them, I'll wait for you here.
      </p>
      <a href="#ready" class="ready">Have everything? Continue!</a>
    </div>
    </div> <!-- ingredients -->
  </div><!-- recipe-text -->
    
  <div class="recipe-directions clearfix" id="ready">
    <h2>Directions</h2>
    <ul>
      <li>
        <span class="icon-fire"></span> Get your filthiest campfire-scorched Dutch oven over the fire the best you can situate it. Brown the bison. Add the diced onion and spices, sautee until soft.
      </li>
    
      <li>
        <span class="icon-stopwatch"></span> Add tomatoes and broth and bring to a simmer for 40 minutes. Add beans and cook another 30 minutes.
      </p>
    
      <li>
        <span class="icon-leaf"></span> After that, taste, and adjust salt, pepper, and chili powder if necessary. If you have other spicy ingredients that suit you best, go for it.
      </li>
    
      <li>
        <span class="icon-thumbs-up"></span> The longer the chili simmers, the better it will taste. Remove from heat and serve, or refrigerate, and serve the next day.
      </li>

      <li>
        <span class="icon-food"></span> Serve with Tabasco and a <span class="small-caps">giant</span> spoon.
      </li>
    </ul>
  </div> <!-- .recipe-directions -->
  
</article>

<footer>
  <p>
    Best viewed in <a href="https://codepen.io/timwagner/full/rjDKv" data-tooltip="Right click > Open in new tab">full page</a>.
  </p>

  <p>
    This is a pen for the <a href="https://blog.codepen.io/rodeo/season-three/#week-one">Codepen Pattern Rodeo</a>.
  </p>
  
  <p>
    Handcrafted with <span>♥</span> in Germany.
  </p>
</footer>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Averia+Serif+Libre:700);

* {
  box-sizing: border-box;
  margin: 0; padding: 0;
}

html {
  font-size: 16px;
}

h1, h2 {
  font-family: 'Averia Serif Libre', sans-serif;
  margin: 0 0 20px 0;
}

h2 { font-size: 200%; }

.small-caps { font-variant: small-caps; }

/* Tooltip for links */
a:hover {
  position: relative;
}

a[data-tooltip]:hover:after {
  content: attr(data-tooltip);
  position: absolute;
  padding: 4px 8px;
  color: #2C3E50;
  background: #D8D8D8;
  border-radius: .2em;
  left: -50%;
  bottom: 120%;
  white-space: nowrap;
  z-index: 20px;
}


/***********************************************\
|           header                              |  
\***********************************************/
header {
  background: white;

  h1 {
    text-align: center;
    padding-top: 25px;
    font-size: 250%;
  }
  
  #campfire {
    position: relative;
    z-index: 2;
    margin: -25px auto 0 auto;
    width: 90px;
    height: 100px;
    background: white;
    border-radius: 50%;
    transform: translate(0,20px);
  
    #flames div {
      position: absolute;
      width: 0px;
      height: 50px;
      border-bottom: 50px solid rgba(255,90,5,1);
      border-left: 25px solid transparent;
      border-right: 25px solid transparent;
      border-radius: 100%;
    }
    
    #flames div:nth-of-type(1) { -webkit-animation: flames1 .3s .2s infinite; -moz-animation: flames3 .3s .2s infinite; }
    #flames div:nth-of-type(2) { top: 0;left: 20px; -webkit-animation: flames2 .3s infinite; -moz-animation: flames2 .3s infinite; }
    #flames div:nth-of-type(3) { top: 0;left: 40px; -webkit-animation: flames3 .3s .1s infinite; -moz-animation: flames3 .3s .1s infinite; }
    
    #logs div {
      position: absolute;
      top: 35px; left: 8px;
      width: 75px;
      height: 25px;
      background: #564737;
      border-radius: 10px/20px;
    }
    
    #logs div:nth-of-type(1) { transform: rotate(15deg); }
    #logs div:nth-of-type(2) { transform: rotate(-15deg); }
  }
}


/***********************************************\
|           main                                |  
\***********************************************/

/* Intro */
.recipe-text {
  .intro {
    background: #e74c3c;
    color: white;
    padding: 50px calc(50% - 960px/2); 
    /*http://lea.verou.me/more-css-secrets/#padding-auto*/
    
    p {
      float: right;
      width: 55%;
      background: rgba(255,255,255,0.2);
      border-radius: 5px;
      padding: 10px;
      margin-right: 5%;
      font-size: 120%;
    }
    
    .preview-img {
      position: relative;
      width: 40%;
      float: right;
      padding: 5px 5px 25px 5px;
      background: #E3E3E3;
      border: 1px solid #333;
      transform: rotate(2deg);
    }
  }
}

/* Ingredients */
.ingredients {
  padding: 50px calc(50% - 960px/2);
  background: #D8D8D8;
  width: 100%;
  font: 110%/1.5 Arial, sans-serif;
  
  ul {
    width: 34%;
    float: left;
    margin-left: 3%;
  }
  
  ul li {
    list-style-type: none;
  }
  
  /* Checkbox */
  input[type="checkbox"] {
    display:none;
  }
  input[type="checkbox"] + label span {
    position: relative;
    display: inline-block;
    width: 15px;
    height: 15px;
    margin: 0 5px 0 0;
    vertical-align: middle;
    background: #b3b3b3;
    cursor: pointer;
    border-radius: 3px;
    overflow: hidden;
    transition: background .3s .3s;
    line-height: 1;
  }
  
  input[type="checkbox"]:checked + label span {
    background: transparent; 
  }
  
  input[type="checkbox"] + label span:before {
    content:"";
    position: absolute;
    top: 100%;
    left: 0;
    transform: rotate(180deg);
    transition: top .3s, left .3s, transform .3s; 
  }
  
  input[type="checkbox"]:checked + label span:before {
    content: "✓";
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(0deg);

  }
  
  input[type="checkbox"]:checked + label {
    text-decoration: line-through;
    color: #444;
  }
  
  label {
    cursor: pointer;
  }
  
  /* Calculate */
  .calculate {
    float: left;
    width: 60%;
    
    p {
      font: italic 120% Georgia, serif;
      text-align: center;
    }
    
    a.ready {
      display: block;
      width: 50%;
      padding: 1em .5em;
      margin: 50px auto;
      background: #27ae60;
      color: white;
      text-align: center;
      text-decoration: none;
      border-radius: .6em;
    }
    
    a.ready:hover, a.ready:focus { background: #2ecc71; }
  }
}

/* Directions */
.recipe-directions {
  padding: 50px calc(50% - 960px/2);
  background: tan;
  
  li {
    position: relative;
    float: left;
    width: 46%;
    height: 250px;
    padding: 10px 10px 60px 10px;
    margin: 2%;
    background: rgba(255,255,255,0.2);
    font: 125%/1.5 Arial, sans-serif;
    vertical-align: top;
    list-style-type: none;
    border-radius: .5em;
    
    span[class^="icon"] {
      color: rgba(0,0,0,0.4);
      position: absolute;
      bottom: 5%; right: 5%;
      font-size: 400%;
    }
  }
  
  li:last-of-type {
    width: 96%;
    font: italic 200% Georgia, serif;
    text-align: center;
    padding: 40px 10px 50px 10px;
  }
} /* .recipe-directions */


/***********************************************\
|           footer                              |  
\***********************************************/

footer {
  width: 100%;
  padding: 50px calc(50% - 960px/2);
  background: #2c3e50;
  color: #ddd;
  text-align: center;
  font: 100%/1.5 Arial, sans-serif;
  
  a {
    color: #ddd;
    text-decoration: none;
    padding: 2px 3px;
  }
  
  p { margin-bottom: 25px; }
  span { color: white; transition: color .3s; }
}

footer:hover {
  a { border-bottom: 1px dotted; }
  a:hover { background: #ddd; color: #2c3e50; border: none;}
  span { color: red; }
}


/***********************************************\
|           animations                          |  
\***********************************************/
/* flames 1 */
@keyframes flames1 {
  from { transform: rotate(-5deg) scale(1,1); opacity: 0.9; }
  50%  { transform: rotate(5deg) scale(0.8,0.8); opacity: 0.8; }
  to   { transform: rotate(-5deg) scale(1,1); opacity: 1; }
}

@-webkit-keyframes flames1{from{-webkit-transform:rotate(-5deg) scale(1,1);opacity: 0.9;}50%{-webkit-transform:rotate(5deg) scale(0.8,0.8);opacity: 0.8;}to{-webkit-transform: rotate(-5deg) scale(1,1); opacity: 1;}}@-moz-keyframes flames1{from{-moz-transform:rotate(-5deg) scale(1,1);opacity: 0.9;}50%{-moz-transform:rotate(5deg) scale(0.8,0.8); opacity: 0.8;}to{-moz-transform:rotate(-5deg) scale(1,1);opacity: 1;}}

/* flames2 */
@keyframes flames2 {
  from { transform: rotate(0deg) scale(1,1); opacity: 1; }
  50%  { transform: rotate(-5deg) scale(0.8,0.8); opacity: 0.9; }
  to   { transform: rotate(0deg) scale(1,1); opacity: 1; }
}

@-webkit-keyframes flames2 {from{-webkit-transform: rotate(0deg) scale(1,1);opacity: 1;}50%{ -webkit-transform: rotate(-5deg) scale(0.8,0.8); opacity: 0.9; }to{-webkit-transform: rotate(0deg) scale(1,1); opacity: 1; }}@-moz-keyframes flames2 {from{-moz-transform: rotate(0deg) scale(1,1);opacity: 1; }50%{ -moz-transform: rotate(-5deg) scale(0.8,0.8); opacity: 0.9; }to{ -moz-transform: rotate(0deg) scale(1,1); opacity: 1; }}

/* flames 3 */
@keyframes flames3 {
  from { transform: rotate(0deg) scale(1,1); opacity: 0.9; }
  50%  { transform: rotate(5deg) scale(0.9,0.9); opacity: 1; }
  to   { transform: rotate(0deg) scale(1,1); opacity: 0.9; }
}

@-webkit-keyframes flames3 {from{-webkit-transform:rotate(0deg) scale(0.9,0.9);opacity:0.9;}50%{-webkit-transform: rotate(5deg) scale(1,1);opacity: 1;}to{ -webkit-transform: rotate(0deg) scale(0.9,0.9); opacity: 0.9; }}@-moz-keyframes flames3 {from {-moz-transform:rotate(0deg) scale(0.9,0.9);opacity: 0.9;}50%{-moz-transform:rotate(5deg) scale(1,1);opacity: 1;}to{ -moz-transform:rotate(0deg) scale(0.9,0.9); opacity: 0.9;}}

/* Clearfix */
.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}
 
.clearfix {
    display: inline-block;
}
 
html[xmlns] .clearfix {
    display: block;
}
 
* html .clearfix {
    height: 1%;
}


/***********************************************\
|           responsive                          |  
\***********************************************/

/* Tablet */
@media only screen and (max-width: 768px) {
  .recipe-text {
    .intro {
      p {
        float: none;
        width: 100%;
        background: rgba(255,255,255,0.2);
        border-radius: 0;
        padding: 20px 30px;
        margin: 2% 0 0 0;
        font-size: 120%;
      }
        
      .preview-img {
        position: relative;
        width: 100%;
        float: none;
        padding: 0;
        background: #E3E3E3;
        border: none;
        transform: rotate(0deg);
      }
    }
    
    .ingredients {  
      ul {
        width: 100%;
        margin: 0 0 3% 5%;
        float: none;
        column-count: 2;
        column-gap: 60px;
        column-rule: 1px solid #555;
      }
      
      input[type="checkbox"] + label span {
        display: none;
      }
      
      .calculate {
        float: none;
        width: 100%;
    
        p { padding: 10px; }
        a.ready { width: 90%; }
      }
    } /* .ingredients */
  } /* .recipe-text */
  footer { 
    a { border-bottom: 1px dotted; }
    a:hover { background: #ddd; color: #2c3e50; border: none;}
    span { color: red; }
  }
} /* media query */

/* Smartphone */
@media only screen and (max-width: 480px) {
  body { font-size: 120%; }
  
  .recipe-text {
    .ingredients { 
      ul {
        width: 100%;
        margin: 0 0 3% 5%;
        float: none;
        column-count: 1;
      }
      
      input[type="checkbox"] + label span {
        display: inline-block;
        width: 20px; height: 20px;
      }
    } /* .ingredients */
  } /* .recipe-text */
  
  .recipe-directions {
    li {
      position: relative;
      float: left;
      width: 100%;
      height: auto;
      padding: 10px;
      margin: 2% 0;
      background: rgba(255,255,255,0.2);
      font: 125%/1.5 Arial, sans-serif;
      list-style-type: none;
      border-radius: 0;
      overflow-y: hidden;
    }
    
    li span[class^="icon"] {
      color: rgba(0,0,0,0.4);
      position: static;
      font-size: 100%;
    }
  
    li:last-of-type {
      width: 100%;
      font: italic 125% Georgia, serif;
      text-align: center;
      padding: 40px 10px 50px 10px;
      background: transparent;
    }
  } /* .recipe-directions */
  footer { 
    a { border-bottom: 1px dotted; }
    a:hover { background: #ddd; color: #2c3e50; border: none;}
    span { color: red; }
  }
} /* media query */
              
            
!

JS

              
                /* Smooth Scroll */
$(function() {
  $('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
        $('html,body').animate({
          scrollTop: target.offset().top
        }, 1000);
        return false;
      }
    }
  });
});
              
            
!
999px

Console