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

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

              
                <!-- 
Designed by Alex Arutuynov 🤘
https://dribbble.com/shots/11367803-Credit-Cards
-->

<div class="cc">
  <div class="cc__front">
    <div class="cc__brand">
      <div class="cc__brand-logo">
        <span class="cc__logo-circle cc__logo-circle--left"></span>
        <span class="cc__logo-circle cc__logo-circle--right"></span>
      </div>
      <span class="cc__brand-text">Mastercard</span>
    </div>
    <div class="cc__number">
      <span class="cc__number-dot"></span>
      <span class="cc__number-dot"></span>
      <span class="cc__digits">2130</span>
    </div>
    <div class="cc__balance-text">$ 4,600.00</div>
  </div>
  <div class="cc__settings">
    <div class="cc__settings-menu">
      <div class="cc__settings-menu-item">
        <div class="cc__settings-menu-item-icon">
          <svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20"><path d="M12 1C8.676 1 6 3.676 6 7v1c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2V7c0-3.324-2.676-6-6-6zm0 2c2.276 0 4 1.724 4 4v1H8V7c0-2.276 1.724-4 4-4zm0 10c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2z"/></svg></div>Lock card
      </div>
      <div class="cc__settings-menu-item"> <div class="cc__settings-menu-item-icon">
        <svg fill="#fff" xmlns="http://www.w3.org/2000/svg"  viewBox="0 0 32 32" width="24px" height="24px"><path d="M 16 4 C 10.886719 4 6.617188 7.160156 4.875 11.625 L 6.71875 12.375 C 8.175781 8.640625 11.710938 6 16 6 C 19.242188 6 22.132813 7.589844 23.9375 10 L 20 10 L 20 12 L 27 12 L 27 5 L 25 5 L 25 8.09375 C 22.808594 5.582031 19.570313 4 16 4 Z M 25.28125 19.625 C 23.824219 23.359375 20.289063 26 16 26 C 12.722656 26 9.84375 24.386719 8.03125 22 L 12 22 L 12 20 L 5 20 L 5 27 L 7 27 L 7 23.90625 C 9.1875 26.386719 12.394531 28 16 28 C 21.113281 28 25.382813 24.839844 27.125 20.375 Z"/></svg></div>Replace card</div>
      <div class="cc__settings-menu-item">
        <div class="cc__settings-menu-item-icon">
          <img src="https://assets.codepen.io/452974/more-48.png?format=auto"  style="width: 24px;"/>
        </div>More
      </div>
    </div>
    <div class="cc__settings-bar">
      <svg class="gear-icon icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path d="M9.668 2l-.492 2.523c-.821.31-1.58.744-2.246 1.291L4.506 4.98 2.174 9.02l1.94 1.686A8.012 8.012 0 004 12c0 .441.045.871.113 1.293l-1.94 1.686 2.333 4.042 2.424-.835c.666.547 1.425.98 2.246 1.29L9.668 22h4.664l.492-2.523c.821-.31 1.58-.744 2.246-1.291l2.424.835 2.332-4.042-1.94-1.686c.07-.422.114-.852.114-1.293 0-.441-.045-.871-.113-1.293l1.94-1.686-2.333-4.042-2.424.835a7.983 7.983 0 00-2.246-1.29L14.332 2H9.668zM12 8a4 4 0 110 8 4 4 0 010-8z"/></svg>
      <svg class="apple-pay-icon icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="48" height="48"><path d="M9.984 15.002c-.835.04-1.866.571-2.455 1.318-.54.644-1.001 1.69-.884 2.672.943.082 1.885-.492 2.474-1.219.58-.747.963-1.748.865-2.771zM18 17v15h2.375v-5h3.25c2.983 0 5.125-2.075 5.125-5s-2.103-5-5.047-5H18zm-8.266 2c-.8 0-1.465.214-1.95.395-.487.18-.855.27-.745.27.099 0-.241-.083-.678-.259-.436-.176-1.021-.402-1.738-.402-1.625 0-3.087.966-3.88 2.371-.799 1.383-.869 2.992-.61 4.467.259 1.474.845 2.844 1.556 3.879.317.465.684.983 1.176 1.43.492.445 1.167.841 1.979.841H4.88c.638-.024 1.12-.237 1.424-.361.304-.124.456-.19.845-.19.383 0 .54.07.873.205.334.136.86.354 1.541.354.803 0 1.478-.405 1.938-.854.46-.447.782-.948 1.082-1.388l.002-.002a8.858 8.858 0 001.127-2.37l.248-.882-.86-.322s-1.27-.372-1.283-1.989v-.002a2.087 2.087 0 01.512-1.412 2.689 2.689 0 01.518-.478c.033-.023-.04.04.12-.084l.749-.572-.526-.782C12.088 19.224 10.405 19 9.734 19zm10.641 0h2.75c2.047 0 3.25 1.105 3.25 3s-1.193 3-3.25 3h-2.75v-6zm-10.64 2c.133 0 .62.143 1.115.443-.023.026-.04.035-.063.063a4.184 4.184 0 00-.969 2.705c.015 1.805.928 2.69 1.686 3.227-.123.338-.18.62-.57 1.19l-.002.003c-.307.45-.586.852-.825 1.084-.238.232-.357.285-.543.285-.305 0-.435-.062-.787-.205-.351-.143-.907-.354-1.627-.354-.703 0-1.252.196-1.601.338-.338.138-.468.194-.719.207-.173-.003-.354-.074-.621-.316-.273-.247-.577-.648-.867-1.074v-.002l-.002-.002c-.527-.766-1.032-1.932-1.236-3.096-.205-1.164-.11-2.296.37-3.125l.005-.006.001-.004c.455-.806 1.354-1.357 2.143-1.357.271 0 .609.104.99.258.382.154.755.402 1.426.402.674 0 1.033-.243 1.441-.394.41-.152.81-.27 1.254-.27zm24.464 0c-2.489 0-4.328 1.395-4.396 3.314h2.11c.173-.912 1.036-1.51 2.218-1.51 1.433 0 2.242.657 2.242 1.864l.002.832-2.932.154c-2.72.161-4.193 1.255-4.193 3.155 0 1.919 1.52 3.193 3.7 3.193 1.471 0 2.837-.732 3.456-1.89h.05v1.775h2.167v-7.371c.001-2.14-1.74-3.516-4.424-3.516zm5.301 0l4.008 10.95-.215.665c-.362 1.13-.948 1.563-1.994 1.563-.18 0-.518-.018-.674-.037v1.804c.158.035.708.055.879.055 2.307 0 3.393-.868 4.342-3.502L50 21h-2.404l-2.787 8.885h-.05L41.974 21H39.5zm-3.125 6l-.008.867c0 1.387-1.2 2.375-2.789 2.375-1.249 0-2.043-.588-2.043-1.49 0-.931.766-1.473 2.229-1.559L36.375 27z"/></svg>
    </div>
  </div>
</div>



<!-- Dribble Link  -->
  <a class="dribbble-link" href="https://dribbble.com/shots/11367803-Credit-Cards" target="_blank" class="dribble-link"><svg width="45" height="45" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="100" height="100" fill="#000" fill-opacity="0"/><circle cx="50" cy="50" r="48" fill="#EA4C89"/><path fill-rule="evenodd" clip-rule="evenodd" d="M50 0C22.397 0 0 22.397 0 50C0 77.603 22.397 100 50 100C77.5488 100 100 77.603 100 50C100 22.397 77.5488 0 50 0ZM83.026 23.0477C88.9913 30.3145 92.5705 39.5879 92.679 49.6204C91.269 49.3492 77.1692 46.4751 62.961 48.2646C62.6356 47.5597 62.3644 46.8004 62.0391 46.0412C61.1714 43.9805 60.1952 41.8655 59.2191 39.859C74.9458 33.4599 82.1041 24.2408 83.026 23.0477ZM50 7.37527C60.846 7.37527 70.7701 11.4425 78.308 18.1128C77.5488 19.1974 71.0954 27.82 55.9111 33.5141C48.9154 20.6616 41.1605 10.141 39.9675 8.5141C43.167 7.75488 46.5293 7.37527 50 7.37527ZM31.833 11.3883C32.9718 12.9067 40.564 23.4816 47.6681 36.0629C27.7115 41.3774 10.0868 41.269 8.18872 41.269C10.9544 28.0369 19.9024 17.0282 31.833 11.3883ZM7.26681 50.0542C7.26681 49.6204 7.26681 49.1866 7.26681 48.7527C9.11063 48.8069 29.8265 49.0781 51.1388 42.679C52.3861 45.0651 53.5249 47.5054 54.6095 49.9458C54.0672 50.1085 53.4707 50.2712 52.9284 50.4338C30.9111 57.538 19.1974 76.9523 18.2213 78.5792C11.4425 71.0412 7.26681 61.0087 7.26681 50.0542ZM50 92.7332C40.1302 92.7332 31.0195 89.3709 23.8069 83.731C24.5662 82.1584 33.243 65.4555 57.321 57.0499C57.4295 56.9957 57.4837 56.9957 57.5922 56.9414C63.6117 72.5054 66.0521 85.5748 66.7028 89.3167C61.551 91.5401 55.9111 92.7332 50 92.7332ZM73.807 85.4122C73.3731 82.8091 71.0955 70.3362 65.5098 54.9892C78.9046 52.8742 90.6182 56.3449 92.0824 56.833C90.2386 68.7093 83.4056 78.9588 73.807 85.4122Z" fill="#C32361"/></svg></a>

              
            
!

CSS

              
                .cc {
  height: 220px;
  width: 386px;
  position: relative;
  
  background: #6c7cff;
  border-radius: 30px;
  color: #fff;
  
  &__front {
    display: flex;
    flex-direction: column;
    align-items: left;
    padding: 24px 38px 38px;
  }
  
  &__brand {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
  }
  
  &__brand-logo {
    display: flex;
  }
  
  &__logo-circle {
    width: 30px;
    height: 30px;
    background: #fff;
    display: block;
    border-radius: 50%;
    position: relative;
    
    
    &--left {
      opacity: .5;
    }
    
    &--right {
      left: -10px;
      opacity: .3;
    }
  }
  
  &__brand-text {
    font-size: 17px;
    margin-left: 5px;
  }
  
  &__number {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
  }
  
  &__number-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    display: inline-block;
    margin-right: 4px;
  }
  
  &__digits {
    font-size: 20px;
    margin-left: 10px;
  }
  
  &__balance-text {
    font-weight: 600;
    font-size: 36px;
  }
  
  &__settings {
    width: 100%;
    height: 100%;
    
    background: #4c5be8;
    border-radius: 30px;
    position: absolute;
    top: 0;
    display: flex;
    justify-content: space-between;
    padding: 22px 10px;
    clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L320.261415,228.834835 C320.261415,219.284137 320.261415,209.299312 320.261415,198.880359 C320.261415,186.645109 320.261415,149.508543 320.261415,110 C320.261415,70.4914571 320.261415,43.8454079 320.261415,21.9752985 C320.261415,3.85122438 320.261415,-7.69033824 320.261415,-12.6493894 L387.118151,-12.6493894 Z');
    
    &--active {
      animation: showSettings 2s ease-in-out forwards;
    }
    
    &--hidden {
      clip-path: path('M387.118151,0.160365095 L387.118151,221.215264 L316.529346,221.215264 C117.007895,237.0198 17.2471697,237.0198 17.2471697,221.215264 C17.2471697,181.988409 17.2471697,133.22115 17.2471697,110 C17.2471697,86.7788496 17.2471697,27.7576259 17.2471697,-6.39488462e-14 C17.2471697,-16.3318577 117.007895,-16.2784027 316.529346,0.160365095 L387.118151,0.160365095 Z');
      animation: hideSettings 2s ease-in-out forwards;
    }
  }
  
  &__settings-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 32px;
  }
  
  &__settings-menu-item {
    display: flex;
    align-items: center;
  }
  
  &__settings-menu-item-icon {
    display: flex;
    padding: 4px 6px;
    background: #5f6ff6;
    border-radius: 7px;
    margin-right: 15px;
  }
  
  &__settings-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
  }
}

.icon {
  fill: #fff;
}

.apple-pay-icon {
  transform: rotate(-90deg);
}

.gear-icon {
  cursor: pointer;
  opacity: .5;
  
  transition: opacity 1.5s;
  
  &.active {
    opacity: 1;
  }
}


@keyframes showSettings {
  25% {
    clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L326.156587,228.834835 C316.225565,222.276395 309.894513,217.352564 307.16343,214.063341 C298.576801,203.721899 122.1888,208.462135 122.1888,108.204535 C122.1888,7.94693437 294.206316,25.6769042 315.855488,6.20473783 C320.120314,2.36877547 323.554014,-3.91593359 326.156587,-12.6493894 L387.118151,-12.6493894 Z')
  }
  
  50% {
     clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L48.4642624,238.145348 C18.8858367,241.43457 2.73108257,241.43457 6.66133815e-15,238.145348 C-8.58662882,227.803906 18.4317885,204.651574 18.4317885,104.393974 C18.4317885,4.13637332 -13.6376238,0.776583538 8.01154821,-18.6955828 C12.2763746,-22.5315451 25.7606127,-20.5161473 48.4642624,-12.6493894 L387.118151,-12.6493894 Z')
  }
  
  65%, 100% {
    clip-path: path('M387.118151,0.160365095 L387.118151,221.215264 L316.529346,221.215264 C117.007895,237.0198 17.2471697,237.0198 17.2471697,221.215264 C17.2471697,181.988409 17.2471697,133.22115 17.2471697,110 C17.2471697,86.7788496 17.2471697,27.7576259 17.2471697,-6.39488462e-14 C17.2471697,-16.3318577 117.007895,-16.2784027 316.529346,0.160365095 L387.118151,0.160365095 Z')
  }
}

@keyframes hideSettings {
  25% {
   clip-path: path('M387.118151,0.160365095 L387.118151,221.215264 L316.529346,221.215264 C100.704923,235.24635 -4.80485907,234.841262 1.15518706e-13,220 C12.4189217,181.640401 18.8873389,174.136909 17.2471697,110 C15.6070006,45.8630911 13.7675117,26.4098973 1.04860565e-13,0.160365095 C-6.27713368,-11.8077978 99.2326483,-11.8077978 316.529346,0.160365095 L387.118151,0.160365095 Z')
  }
  
  55% {
     clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L243.77087,228.834835 C216.843505,221.535077 202.014282,216.240588 199.283199,212.951365 C190.69657,202.609923 14.0082036,210.2576 14.0082036,110 C14.0082036,9.74239964 184.417555,28.4484097 208.443623,13.7028253 C213.730293,10.4582224 224.482747,1.6741509 240.700984,-12.6493894 L387.118151,-12.6493894 Z')
  }
  
  80% {
    clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L315.554768,228.834835 C317.523992,218.414953 319.092875,208.430128 320.261415,198.880359 C321.744382,186.760968 330.890906,150.167879 333.898886,110 C336.906867,69.8321206 320.261415,43.8454079 320.261415,21.9752985 C320.261415,3.85122438 318.692532,-7.69033824 315.554768,-12.6493894 L387.118151,-12.6493894 Z')
  }
  
   100% {
    clip-path: path('M387.118151,-12.6493894 L387.118151,228.834835 L320.261415,228.834835 C320.261415,219.284137 320.261415,209.299312 320.261415,198.880359 C320.261415,186.645109 320.261415,149.508543 320.261415,110 C320.261415,70.4914571 320.261415,43.8454079 320.261415,21.9752985 C320.261415,3.85122438 320.261415,-7.69033824 320.261415,-12.6493894 L387.118151,-12.6493894 Z');
  }
}

@import url('https://fonts.googleapis.com/css2?family=Urbanist:[email protected];400;600&display=swap');

/* Base Styles */

*,
*:before,
*:after {
  box-sizing: border-box;
}


html,
body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  
  font-family: 'Urbanist', sans-serif;
}

.dribbble-link {
  position: absolute;
  right: 30px;
  bottom: 30px;
}
              
            
!

JS

              
                const gear = document.querySelector('.gear-icon');
const ccSettings = document.querySelector('.cc__settings');

gear.addEventListener('click', () => {
  if (gear.classList.contains('active')) {
    ccSettings.classList.remove('cc__settings--active');
    ccSettings.classList.add('cc__settings--hidden');
  } else {
    ccSettings.classList.remove('cc__settings--hidden');
    ccSettings.classList.add('cc__settings--active');
  }
  gear.classList.toggle('active');
});
              
            
!
999px

Console