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 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

              
                <article>
   <div class="like">
      <div class="icon">
         <svg viewBox="0 0 24 24">
            <path
                  d="M2.9219 12.4463C1.8489 9.0963 3.1039 4.9313 6.6209 3.7993C8.4709 3.2023 10.7539 3.7003 12.0509 5.4893C13.2739 3.6343 15.6229 3.2063 17.4709 3.7993C20.9869 4.9313 22.2489 9.0963 21.1769 12.4463C19.5069 17.7563 13.6799 20.5223 12.0509 20.5223C10.4229 20.5223 4.6479 17.8183 2.9219 12.4463Z"
                  />
         </svg>
      </div>
      <div class="shadow"></div>
      <div class="number">232</div>
   </div>
   <div class="content">
      <h1>PayPal Payment Method</h1>
      <span>⏱ In Progress</span>
      <p>
         We'd like to introduce custom domains to enable white labeling
         services. The thing that holds us back at the moment is the fact that
         we currently offer HTTPS on every public dashboard. Customizing your
         URL would make it an HTTP page.
      </p>
      <p>
         We're currently thinking of an easy way of implementing this HTTPS.
      </p>
   </div>
</article>

<article>
   <div class="like active">
      <div class="icon">
         <svg viewBox="0 0 24 24">
            <path
                  d="M2.9219 12.4463C1.8489 9.0963 3.1039 4.9313 6.6209 3.7993C8.4709 3.2023 10.7539 3.7003 12.0509 5.4893C13.2739 3.6343 15.6229 3.2063 17.4709 3.7993C20.9869 4.9313 22.2489 9.0963 21.1769 12.4463C19.5069 17.7563 13.6799 20.5223 12.0509 20.5223C10.4229 20.5223 4.6479 17.8183 2.9219 12.4463Z"
                  />
         </svg>
      </div>
      <div class="shadow"></div>
      <div class="number">420</div>
   </div>
   <div class="content">
      <h1>Language Switch</h1>
      <span>✨ New </span>
      <p>
         Currently we auto detect the browser language and set the language of
         the public dashboard this way. It might be that the user has an
         English browser but actually prefers reading the content in German.
      </p>
   </div>
</article>

<div class="socials">
   <a class="twitter" href="https://twitter.com/slawejaskulski" target="_blank">
      <svg viewBox="0 0 72 72">
         <path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z">  </path>
      </svg>
   </a>
   <a class="dribbble" href="https://dribbble.com/fireblader" target="_blank">
      <img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg"/>
   </a>
</div>

              
            
!

CSS

              
                .like {
   --color: #000;
   --background: #fff;
   --stroke: #6b7280;
   --border-color: #e5e7eb;
   --fill: #e5e7eb;
   --a-color: #10b981;
   --a-background: #ecfdf5;
   --a-stroke: #10b981;
   --a-border-color: #a7f3d0;
   --a-fill: #a7f3d0;
   --height: 66px;
   --width: 66px;
   --radius: 6px;
   --duration: 0.3s;
   --function: cubic-bezier(0, 0.88, 0.46, 1.36);
   --shadow: #{rgba(#000, 0.05)};
   position: relative;
   background: none;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   height: var(--height);
   width: var(--width);
   padding: 0;
   margin: 0;
   user-select: none;
   outline: none;
   cursor: pointer;
   -webkit-appearance: none;
   -webkit-tap-highlight-color: transparent;

   &:hover {
      &:before {
         --b-shadow: 0 0 4px 1px var(--shadow);
      }
      .icon {
         --i-bottom: 3px;
      }
      .shadow {
         --s-opacity: 1;
      }
   }

   &:active {
      &:before {
         --b-height: calc(var(--height) + 2px);
         --b-radius: calc(var(--radius) * 5) calc(var(--radius) * 5) var(--radius)
            var(--radius) / calc(var(--radius) * 1.6) calc(var(--radius) * 1.6)
            var(--radius) var(--radius);
      }
      .icon {
         --i-bottom: 17px;
      }
      .shadow {
         --s-width: 20px;
      }
      .number {
         --n-top: 2px;
      }
   }

   &.active {
      &:before {
         --background: var(--a-background);
         --border: var(--a-border-color);
      }
      .icon {
         --fill: var(--a-border-color);
         --stroke: var(--a-stroke);
      }
      .number {
         --color: var(--a-color);
      }
   }

   &:before {
      --delay: 50ms;
      content: "";
      z-index: -1;
      position: absolute;
      bottom: 0;
      background: var(--background);
      border: 1px solid var(--border, var(--border-color));
      height: var(--b-height, calc(100% - 2px));
      width: var(--b-width, calc(100% - 2px));
      box-shadow: var(--b-shadow, none);
      border-radius: var(--b-radius, var(--radius));
      transition: border-radius var(--duration) var(--function) var(--delay),
         height var(--duration) var(--function) var(--delay);
   }

   .icon {
      --size: 24px;
      position: relative;
      display: flex;
      bottom: var(--i-bottom, 0);
      transition: bottom var(--duration) var(--function);
      svg {
         fill: var(--fill);
         stroke: var(--stroke);
         width: var(--size);
         height: var(--size);
         stroke-width: 1.5;
         stroke-linecap: round;
         stroke-linejoin: round;
      }
   }

   .shadow {
      position: absolute;
      background: var(--shadow);
      top: calc(var(--height) - 45%);
      border-radius: 50%;
      height: 2px;
      width: var(--s-width, 14px);
      opacity: var(--s-opacity, 0);
      filter: blur(1px);
      transition: width var(--duration) var(--function),
         opacity var(--duration) var(--function);
   }

   .number {
      color: var(--color);
      position: relative;
      font-weight: 500;
      margin-top: 3px;
      top: var(--n-top, 0);
      transition: top var(--duration) var(--function);
   }
}

// Article
article {
   display: grid;
   grid-template-columns: auto 1fr;
   gap: 20px;
   padding: 10px;
   width: 666px;

   .content {
      box-shadow: 0px 1px 0px #e5e7eb;
      h1 {
         font-weight: 600;
         font-size: 20px;
         margin-bottom: 0.4em;
         line-height: 1.4;
      }
      span {
         color: #6b7280;
         font-size: 14px;
      }
      p {
         margin-top: 0.7em;
         margin-bottom: 1.25em;
         color: #4b5563;
         line-height: 1.4;
      }
   }
}

// Centered starter
* {
   box-sizing: border-box;
   margin: 0;
}

html {
   block-size: 100%;
}

body {
   min-block-size: 100%;
   font-family: "Inter", sans-serif;
   font-size: 16px;
   display: grid;
   place-content: center;
   
   .socials {
      position: fixed;
      display: flex;
      right: 20px;
      bottom: 20px;
      > a {
         display: block;
         height: 28px;
         margin-left: 15px;
         &.dribbble img {
            height: 28px;
         }
         &.twitter svg {
            width: 32px;
            height: 32px;
            fill: #1da1f2;
         }
      }
   }
}

              
            
!

JS

              
                document.querySelectorAll('.like').forEach((button) => {

   button.addEventListener('click', (e) => {
      let number = button.children[2].textContent;

      if (!button.classList.contains('active')) {
         button.classList.add('active');
         button.children[2].textContent = parseInt(number) + 1;
      } else {
         button.classList.remove('active');
         button.children[2].textContent = parseInt(number) - 1;
      }

   });
});

              
            
!
999px

Console