css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class="recipe" id="recipe">
  <div class="image">
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/oatmeal-cookies.jpg" alt="">
  </div>
  <header>
    <h1>The World's Best Oatmeal&nbsp;Cookies</h1>
    <a href="#send-form" class="send-badge">
      <svg width="24" height="24" viewBox="0 0 24 24">
        <path d="M16,18H7V4H16M11.5,22A1.5,1.5 0 0,1 10,20.5A1.5,1.5 0 0,1 11.5,19A1.5,1.5 0 0,1 13,20.5A1.5,1.5 0 0,1 11.5,22M15.5,1H7.5A2.5,2.5 0 0,0 5,3.5V20.5A2.5,2.5 0 0,0 7.5,23H15.5A2.5,2.5 0 0,0 18,20.5V3.5A2.5,2.5 0 0,0 15.5,1Z"></path>
      </svg>
      SMS
    </a>
  </header>
  <div class="ingredients">
    <h3>Ingredients</h3>
    <ul>
      <li>1 cup (2 sticks) butter</li>
      <li>1 cup brown sugar</li>
      <li>1 cup white sugar</li>
      <li>2 eggs</li>
      <li>1 tsp vanilla</li>
      <li>1.5 cups white flour</li>
      <li>1 tsp baking soda</li>
      <li>1/2 tsp salt</li>
      <li>3 cups oatmeal</li>
      <li>1.5-2 cups chocolate chips</li>
    </ul>
  </div>
  <div class="instructions">
    <h3>Steps</h3>
    <ol>
      <li>Set oven to 350&deg;F</li>
      <li>Mix sugars and butter together. You want the butter to be soft. I usually take it out of the fridge a few hours before I start making my cookies. You can microwave the butter but it just doesn’t work out as well.</li>
      <li>Add eggs & vanilla, mix</li>
      <li>Mix in flour, salt, & baking soda</li>
      <li>Mix in the oatmeal</li>
      <li>Stir in some semi-sweet chocolate chips I recommend between 1.5 – 2 cups. Mini chocolate chips work well too.</li>
      <li>The finished dough won’t look like your typical non-oatmeal dough since there’s less flour in it. That’s fine and expected.</li>
      <li>I recommend 3 sheets of 12 cookies each, cooked one sheet at a time.</li>
      <li>Depending on your oven and cookie size each batch should take about 10-15 minutes. I average about 12 minutes per cookie sheet.</li>
      <li>Here’s the most important part of this recipe and where I usually lose people. You have to take them out before they look totally done. People who haven’t tried my cookies fight me on this, but trust me, you absolutely need to take them out earlier
        than you would expect. Judging exactly when is a skill but I’d recommend taking them out when you feel they could use another 3-4 minutes.</li>
    </ol>
  </div>
  <form id="send-form" class="send-form">
    <p>Send this recipe to you or a friend!</p>
    <label for="sms-number">Text to this number:</label>
    <input type="tel" id="sms-number" required placeholder="(555) 555-5555">
    <input type="submit" value="Send" id="send-sms-button">
  </form>
</div>
            
          
!
            
              @import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,400i,700");

* {
  box-sizing: border-box;
}
html {
  font-family: 'Open Sans', sans-serif;
  line-height: 1.4;
  font-size: calc(0.6vw + 0.6vh + 0.2vmin);
  background: linear-gradient(
    -25deg,
    #5C258D,
    #4389A2
  );
}

h1 {
  font-size: 2rem;
  font-weight: 300;
  line-height: 1.1;
  margin: 0;
}

.recipe {
  max-width: 500px;
  border-radius: 6px;
  overflow: hidden;
  margin: 3rem auto;
  background: white;
  box-shadow: 5px 5px 12px rgba(black, 0.2);
  position: relative;
  h3 {
    margin: 0 0 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    color: #5C258D;
    margin: 1rem 0 0.5rem 0;
  }
  .ingredients ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
    li {
      background-image: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
      display: inline-block;
      white-space: nowrap;
      padding: 0.2rem 0.3rem;
      border-radius: 3px;
      margin: 0.2rem 0.1rem;
      font-size: 0.85rem;
    }
  }
  .instructions ol {
    padding: 0 0 0 1.3rem;
    margin: 0;
    li {
      padding: 0 0 1rem 0;
    }
  }
  img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
  }
  header {
    padding: 1.5rem 125px 1rem 2rem;
    background: linear-gradient(
      to bottom,
      #ffffb9,
      white
    );
    margin: 0 0 1rem 0;
  }
  .ingredients,
  .instructions {
    padding: 0 2rem;
  }
  .send-badge {
    background: #5C258D;
    text-align: center;
    border-radius: 50%;
    height: 80px;
    width: 80px;
    position: absolute;
    right: 20px;
    top: 170px;
    text-decoration: none;
    color: white;
    padding: 13px 0 0 0;
    font-size: 0.75rem;
    svg {
      fill: white;
      display: block;
      margin: 0 auto;
      width: 40px;
      height: 40px;
    }
  }
  .send-form {
    background: #4389A2;
    padding: 1rem;
    p {
      color: #d4eeff;
      font-weight: bold;
      margin: 0 0 0.75rem 0;
      font-size: 1.25rem;
    }
    label {
      color: white;
    }
  }
}

            
          
!
            
              const cloudless_function_url = 'https://wt-8081b26e05bb4354f7d65ffc34cbbd67-0.run.webtask.io/twilio';

let form = document.querySelector("#send-form");

form.addEventListener("submit", function(e) {
  e.preventDefault();
  axios.post(cloudless_function_url, {
    // message: document.querySelector("#recipe").textContent,
    message: `You're gonna need butter and eggs.\n\The rest of the instructions are at: https://codepen.io/chriscoyier/full/xPMpGM/`,
    to_number: document.querySelector("#sms-number").value
  })
  .then(function (response) {
    // console.log(response);
  })
  .catch(function (error) {
    // console.log(error);
  });
});

// const url = `https://recipe-sender.azurewebsites.net/api/send-recipe?code=uu/fW4xYnk48WquYSBJbp8S2eBiZ1QX3tOxEXEP1Bet7xVeUW3B3pg==`;


            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console