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

              
                <div class="info-text">Hover over the card</div>

<div class="card-container">
  <div class="container center card-background" data-tilt data-tilt-max="10" data-tilt-glare data-tilt-max-glare="0.3" data-tilt-speed="300">
      <div class="bitmade-logo">
        <svg width="48" height="48" viewBox="0 0 135 135"><defs><clipPath id="clip-path"><rect width="135" height="135" rx="15" transform="translate(801 343)"></rect></clipPath></defs>
              <g transform="translate(-801 -343)" clip-path="url(#clip-path)"><g id="logo-bitmade" transform="translate(801 343)">
                      <g transform="translate(19.5 23.25)"><path d="M63.075,11.55V21.6H74.1V43.8H84.15V21.6h11.1V11.55Z" fill="currentColor"></path>
                          <path d="M33.45,11.55H11.325V.675H1.275V43.8h32.25L33.45,11.55ZM23.1,33.3H11.325V21.45h11.85L23.1,33.3ZM53.25,21.45v-9.9H43.2V25.8a20.271,20.271,0,0,1,8.175-3.975c.525-.15,1.2-.225,1.875-.375" fill="currentColor"></path>
                          <path d="M91.05,67.125C92.85,71.7,77.4,83.1,75.975,69.3c38.475-19.275-6.3-36.525-5.4-.225v.6c-4.575,2.25-2.4-9-1.05-19.725.075-.6.525-4.725.6-6.525C70.8,23.25,54.3,18.6,43.2,28.35c-3.525,3.075-6.225,7.125-6.375,10.575-.075,2.1,2.325,4.95,6.375,1.875v3.15H53.25v-15c3.9-.6,8.025.6,10.125,5.475,1.35,3.225,1.575,7.95.9,14.85a4.912,4.912,0,0,0-1.35-1.125c-6.45-3.825-18.225,8.4-11.85,22.2a9.563,9.563,0,0,0,.525.9c-1.875.825-6.075-2.1-5.175-11.325.15-1.425.3-2.85.45-4.575-1.35.825-2.475,1.8-3.525,2.4A2.645,2.645,0,0,0,42.15,60c-.075,1.2-.15,1.875-.3,3.075,0,0-.3,2.475-.375,2.925C39.9,74.325,33.75,70.95,35.1,59.55c1.2-9.75,7.425-10.05,10.125-7.05a.228.228,0,0,0,.375-.225c-2.025-4.575-6.45-5.325-10.425-3.3C29.7,51.75,25.875,59.625,29.7,70.35c2.85,8.25,13.65.45,13.35-2.55.3,2.025,3.6,5.475,6,5.775a4.5,4.5,0,0,0,3.3-1.275c4.275,4.8,11.1-1.125,11.85-3.9.15,2.7,1.125,3.9,2.325,4.275a1.484,1.484,0,0,0,.825.15,7.587,7.587,0,0,0,3.6-1.05c5.25,15.075,21.225,3.75,23.325-4.95.6-3.15-3.375-.15-3.225.3ZM84.525,61.2a28.758,28.758,0,0,1-8.55,6c1.35-19.275,15.6-13.2,8.55-6ZM43.2,38.775C38.475,42.6,38.25,37.5,43.2,33Zm19.725,28.35C60.45,74.55,54.9,71.175,56.25,60.15c.825-7.125,7.425-10.2,7.35-8.175-.225,6.075-.375,14.1-.675,15.15Z" fill="currentColor"></path>
                          <path d="M66.15,77.4a11.551,11.551,0,0,0-3.225-.45c-6.225-.975-37.5,14.925-38.175-12.3a76.276,76.276,0,0,1,1.125-11.325c.45-2.775-1.8-3.45-3.6-3.975C17.25,47.775,15.6,54.6,15.6,54.6a48,48,0,0,0-.375-5.25,2.555,2.555,0,0,0-4.05-1.65c-4.05,2.325-4.425,7.2-4.425,7.2s-.6-6.45-.525-7.725c-1.5.9-3.3,2.1-4.5,2.85a1.782,1.782,0,0,0-1.05,2.1A102.988,102.988,0,0,1,2.25,75c3.525-1.05,4.725-2.4,4.8-5.7,0-.975.15-14.25,2.925-17.7,2.775-3.525.675,12.225,1.05,15.75.3,3.3,2.025,4.5,4.95,3.825,0-3.825-.825-14.325,1.575-17.925,1.5-2.25,2.25-.375,2.025,2.775C17.025,96.075,52.05,81.6,59.775,82.8c5.475.825,5.55,1.65,6,4.95.15,0,4.125-2.1,4.125-5.7.075-2.175-1.35-3.9-3.75-4.65" fill="currentColor"></path></g></g></g></svg>         </div>
  </div>
  <div class="container center card-background" data-tilt data-tilt-max="10" data-tilt-glare data-tilt-max-glare="0.3" data-tilt-speed="300">
        <div class="bitmade-logo">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">
  <path fill-rule="evenodd" d="M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z" clip-rule="evenodd" />
</svg>
     </div>
      </div>
</div>
              
            
!

CSS

              
                body {
  background-color: #1E293B; /* Sets the background color of the body to dark gray */
  display: flex; /* Uses flexbox layout for the body */
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Horizontally centers flex items within the body */
  font-family: "Red Hat Mono", monospace;
}

.info-text{
  color: white; /* sets the text color */
  font-size: 30px; /* sets the font-size */
  font-weight: 700; /* sets the font weight */
  margin-top: 20px; /* sets top margin */
  margin-bottom: 70px; /* sets bottom margin */
}

.container {
  transform-origin: 50%; /* Sets the origin of transformations to the center of the container */
  transform-style: preserve-3d; /* Ensures that child elements preserve their 3D position when transformed */
}

.center {
  display: flex; /* Uses flexbox layout for elements with the class "center" */
  align-items: center; /* Vertically centers flex items within the container */
  justify-content: center; /* Horizontally centers flex items within the container */
}

.card-background {
  background-color: #334155; /* Sets the background color to a light green */
  width: 400px; /* Sets the width to 550 pixels */
  height: 400px; /* Sets the height to 500 pixels */
  border-radius: 2%; /* Adds a slight border-radius */
}

.bitmade-logo {
  transform: translateZ(80px); /* Translates the element along the z-axis by 90 pixels */
  color: #D7FF73;
}

svg {
  width: 300px; /* Sets the width of SVG elements to 400 pixels */
  height: 300px; /* Sets the height of SVG elements to 400 pixels */
  filter: drop-shadow(0px 0px 6px rgba(0, 0, 0, .4)); /* Applies a drop shadow effect to SVG elements */
}


.card-container {
  display: flex; /* Sets the display to flex */
  gap: 50px; /* Sets the gap between elements to 50px */
}
              
            
!

JS

              
                document.addEventListener('DOMContentLoaded', function() {
  
  const containers = document.querySelectorAll('.container');
  
  // forEach loop to get the shadow function on every element/card
  containers.forEach(container => {
    const svg = container.querySelector('svg');
    
    container.addEventListener('mousemove', function(e) {
      const rect = container.getBoundingClientRect();

      // Calculate the center of the container
      const containerCenterX = rect.left + rect.width / 2;
      const containerCenterY = rect.top + rect.height / 2;

      // Calculate the offset of the mouse pointer from the center of the container
      const offsetX = e.clientX - containerCenterX;
      const offsetY = e.clientY - containerCenterY;

      // Calculate the distance of the mouse pointer from the center of the container
      const distance = Math.sqrt(offsetX * offsetX + offsetY * offsetY);

      // Calculate the maximum possible distance from the center of the container to any corner
      const maxDistance = Math.sqrt((rect.width / 2) * (rect.width / 2) + (rect.height / 2) * (rect.height / 2));

      // intensity of the shadow
      const intensity = 50 ; 

      // Calculate the shadow offset based on the mouse position and intensity
      const shadowX = -(offsetX / rect.width) * intensity;
      const shadowY = -(offsetY / rect.height) * intensity;

      // Calculate the shadow spread based on the distance from the center
      const spread = (distance / maxDistance) * 8; // Adjust the multiplier to control the spread of the shadow

      // Set the drop-shadow filter with the calculated offset and spread
      svg.style.filter = `drop-shadow(${shadowX}px ${shadowY}px ${spread}px rgba(0, 0, 0, 0.4))`;
    });

    container.addEventListener('mouseleave', function() {
      // Reset the drop-shadow filter on mouseleave
      svg.style.filter = `drop-shadow(0px 0px 6px rgba(0, 0, 0, 0.4))`;
    });
  });
});

              
            
!
999px

Console