Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <main id="app">

<h3 class="instructions">Choose your toppins and order! <i class="em em-drooling_face"></i> </h3>

<div class="screen">
  <button class="menu">back to menu</button>
  <div class="product-wrapper">
    <div class="product-info">
  <h1>Protein Waffle</h1>
  <div class="price">$10.99</div>
  <ul class="macros">
    <li>25g protein</li>
    <li>30g carbs</li>
    <li>18g fat</li>
      </ul>
    </div>
      <div class="waffle-img-wrapper">
        <img class="waffle-img" src="https://i.ibb.co/YRCYSrF/Waffle.png" alt="Waffle" border="0"></a>
      </div>
   </div>

<div class="checkout-wrapper">
  
  <div class="extras-wrapper">
    <div class="extra peanut-butter" onclick=toggleCheckmark(this)  v-on:click="updatePrice(peanutButter, 'peanutButter')">
      <svg class="add-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M32 16c0 8.837-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0s16 7.163 16 16zM14 8a2 2 0 1 1 4 0v6h6a2 2 0 1 1 0 4h-6v6a2 2 0 1 1-4 0v-6H8a2 2 0 1 1 0-4h6V8z" fill="#fff"/>
</svg>
      <svg class="checkmark-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16zm-5.69-16.011a2 2 0 0 0-2.62 3.021l4.82 4.182a3 3 0 0 0 4.185-.247l8.284-9.099a2 2 0 0 0-2.958-2.693l-7.627 8.377-4.084-3.541z" fill="#CD8821"/>
</svg>

      <div class="extra-text">Peanut butter</div>
      
    </div>
    <div class="extra yogurt" onclick=toggleCheckmark(this) v-on:click="updatePrice(yogurt, 'yogurt')">
        <svg class="add-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M32 16c0 8.837-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0s16 7.163 16 16zM14 8a2 2 0 1 1 4 0v6h6a2 2 0 1 1 0 4h-6v6a2 2 0 1 1-4 0v-6H8a2 2 0 1 1 0-4h6V8z" fill="#fff"/>
</svg>
      <svg class="checkmark-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16zm-5.69-16.011a2 2 0 0 0-2.62 3.021l4.82 4.182a3 3 0 0 0 4.185-.247l8.284-9.099a2 2 0 0 0-2.958-2.693l-7.627 8.377-4.084-3.541z" fill="#EE6F6F"/>
</svg>
      <div class="extra-text">Yogurt</div></div>
    <div class="extra mixed-berries" onclick=toggleCheckmark(this) v-on:click="updatePrice(mixedBerries, 'mixedBerries')">
        <svg class="add-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M32 16c0 8.837-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0s16 7.163 16 16zM14 8a2 2 0 1 1 4 0v6h6a2 2 0 1 1 0 4h-6v6a2 2 0 1 1-4 0v-6H8a2 2 0 1 1 0-4h6V8z" fill="#fff"/>
</svg>
      <svg class="checkmark-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16zm-5.69-16.011a2 2 0 0 0-2.62 3.021l4.82 4.182a3 3 0 0 0 4.185-.247l8.284-9.099a2 2 0 0 0-2.958-2.693l-7.627 8.377-4.084-3.541z" fill="#AD5AE0"/>
</svg>
      <div class="extra-text">Mixed berries</div></div>
    <div class="extra apple-cinnamon" onclick=toggleCheckmark(this) v-on:click="updatePrice(appleCinnamon, 'appleCinnamon')">
        <svg class="add-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M32 16c0 8.837-7.163 16-16 16S0 24.837 0 16 7.163 0 16 0s16 7.163 16 16zM14 8a2 2 0 1 1 4 0v6h6a2 2 0 1 1 0 4h-6v6a2 2 0 1 1-4 0v-6H8a2 2 0 1 1 0-4h6V8z" fill="#fff"/>
</svg>
      <svg class="checkmark-icon" width="32" height="32" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path fill-rule="evenodd" clip-rule="evenodd" d="M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16zm-5.69-16.011a2 2 0 0 0-2.62 3.021l4.82 4.182a3 3 0 0 0 4.185-.247l8.284-9.099a2 2 0 0 0-2.958-2.693l-7.627 8.377-4.084-3.541z" fill="#65B257"/>
</svg>
      <div class="extra-text">Apple Cinnamon</div></div>
    
     <div class="extra-price">+$2.99 extra</div>
    
    </div>
  
  <div class="divider"></div>
  
  <div class="total-wrapper">
    
    <div>Total</div>
    <div>$ {{ price.toFixed(2) }}</div>
    
  </div>
  
  <button class="eat-it-now">Eat it now</button>
  </div>


</div>
</main>
              
            
!

CSS

              
                body {
  font-family: Nunito Sans;
background: linear-gradient(180deg, #5E1A88 -41.27%, #340451 123.8%);

}

.instructions {
  text-align: center;
  margin-top: 30px;
  color: #E7CCF8;
}

.screen {
  width: 375px;
  height: 812px;
  background-color: #F1F1F1;
  margin: auto;
  margin-top: 30px;
  margin-bottom: 50px;
  border-radius: 10px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}

.menu {
  width: 178px;
  height: 40px;
  cursor: pointer;
  background: #ffffff;
  border: none;
  border-radius: 0px 5px 5px 0px;
  font-size: 16px;
  font-weight: 300;
  text-align: center;
  color: #6B6B6B;
  margin-top: 56px;
}

h1 {
  font-family: Roboto Condensed;
  font-weight: bold;
  font-size: 36px;
  text-transform: uppercase;
  margin-left: 40px;
  margin-bottom: 16px;
  width: 134px;
}

.price {
  margin-left: 40px;
  font-size: 24px;
  font-weight: 300;
}

.macros {
  margin-left: 0px;
  color: #6B6B6B;
  font-size: 16px;
  font-weight: 300;
  list-style: none;
}

.product-wrapper {
  display: flex;
  justify-content: space-between;
}

.waffle-img {
  height: 301px;
}

.checkout-wrapper {
  background-color: #ffffff;
  height: 409px;
  border-radius: 0px 0px 10px 10px;

}


.extras-wrapper {
  display: flex;
  width: 264px;
  height: 264px;
  flex-wrap: wrap;
  margin-left: 36px;
  position: relative;
  top: -45px;
 
  
}

.extra {
  
  background-color: grey;
  height: 124px;
  width: 124px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  border-radius: 15px;
  margin: 4px;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
 

}

.add-icon {
margin: auto;
  margin-top: 16px;
}

.checkmark-icon {
  display: none;
  margin: auto;
  margin-top: 16px;

}
.extra-text {
  height: 40px;
  line-height: 20px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 0;
  right: 0;
  top: 52px;
  
 
}

.hidden {
  display: none;
}

.visible {
  display: block;
}

.peanut-butter {
  background-color: #FFE1B4;
  color: #CD8821;
  
  &:hover {
  background-color: #FFDAA1;
    transform: translatey(1px);
}  
  
}

.peanut-butter.selected {
  
  background-color: #FFDAA1;
  // outline: 3px solid #CD8821;
  // outline-offset: -8px;
  // box-shadow: 0px 0px 0px 2px #FDCB7F inset;
}

.yogurt {
  background-color: #FFCECE;
  color: #EE6F6F;
  
    &:hover {
  background-color: #FFC8C8;

      transform: translatey(1px);
}
  
}

.yogurt.selected {
  background-color: #FFC8C8;

}

.mixed-berries {
  background-color: #E7CCF8;
   color: #AD5AE0;
  
     &:hover {
  background-color: #E8C2FF;
 
       transform: translatey(1px);
}
  
}

.mixed-berries.selected {
   background-color: #E8C2FF;

}

.apple-cinnamon {
  background-color: #CFF1C9;
   color: #65B257;
  
      &:hover {
  background-color: #C0EEB7;

        transform: translatey(1px);
}
  
}

.apple-cinnamon.selected {
    background-color: #C0EEB7;
  box-shadow: inset 0px 6px 0px #BDEAB5;
}

.extra-price {
  color: #6B6B6B;
  font-weight: 300;
  font-size: 16px;
  transform: rotate(-90deg);
  position: absolute;
right: -74px;
top: 125px;
  
}

.divider {
  height: 4px;
  width: 295px;
  margin: auto;
  background-color: #F1F1F1;
  position: relative;
  top: -28px;
  
}

.total-wrapper {
  margin-left: 40px;
  margin-right: 40px;
  margin-top: 18px;
  margin-bottom: 20px;
  font-weight: 300;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  position: relative;
  top: -30px;
}

.eat-it-now {
  width: 295px;
  height: 50px;
  cursor: pointer;
  background: #AD5AE0;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #ffffff;
  margin-left: 40px;
  position: relative;
  top: -30px;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  
  
   &:hover {
    transform: translatey(1px);
    background: #A044D9;
     box-shadow: 0px 2px 10px rgba(160, 68, 217, 0.4);
  }
  
}


              
            
!

JS

              
                function toggleCheckmark(extra) {
  // Toogle the icon
  extra.querySelector(".add-icon").classList.toggle("hidden")
  extra.querySelector(".checkmark-icon").classList.toggle("visible") 
  // Toogle the background
  extra.classList.toggle("selected")
}

var app = new Vue({
  el: '#app',
  data: {
    price: 10.99,
    peanutButter: false,
    yogurt: false,
    mixedBerries: false,
    appleCinnamon: false
  },
  methods: {
    updatePrice: function(extra, extraString) {
      if (extra === false)  {
        this.price += 2.99
      } else {
        this.price -= 2.99
      }
this[extraString] = !extra
    }
  }
})

              
            
!
999px

Console