Create magic button using HTML CSS JS (SOURCE CODE AVAILIABLE)

HEY CODER,

In  this we are going to Create magic button using HTML CSS JS (SOURCE CODE AVAILIABLE)

PREVIEW

3d button css w3schools, 3d button css codepen, css 3d button generator, html animation examples with source code, simple 3d button css, 3d animation html css, 3d button animation, 3d html code ,



SOURCE CODE

<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Magnetic Pastel button</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">

  <style>
     
     *{
        padding: 0;
        margin: 0;
        box-sizing: border-box;
     }

body{
  font-family: 'poppins', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #000000;
}

.btn{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center
  width: 200px;
  padding: 20px 25px;
  border-radius: 50px;
  background: #fff;
  box-shadow: 1px 1px 20px 1px #00fffc;
  font-size: 1.5rem;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.1s;
  overflow: hidden;
}

    .btn span{
      position: relative;
      pointer-events: none;
      color: #000;
      transition: 0.5s;
    }
    .btn:hover::before{
      width: 300px;
      height: 300px;
    }
    .btn:hover span{
      color: #000;
    }

.btn::before{
  content: '';
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%,-50%);
  background: #00fffc;
  width: 0;
  height: 0;
  border-radius: 50px;
  transition: 0.8s, left 0s, top 0s;
}


/* -- YouTube Link Styles -- */

#source-link {
  top: 60px;
}

#source-link > i {
  color: rgb(94, 106, 210);
}

#yt-link {  
  top: 10px;
}

#yt-link > i {
  color: rgb(219, 31, 106);

}

.meta-link {
  align-items: center;
  backdrop-filter: blur(3px);
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;  
  display: inline-flex;
  gap: 5px;
  left: 10px;
  padding: 10px 20px;
  position: fixed;
  text-decoration: none;
  transition: background-color 600ms, border-color 600ms;
  z-index: 10000;
}

.meta-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.meta-link > i, .meta-link > span {
  height: 20px;
  line-height: 20px;
}

.meta-link > span {
  color: white;
  font-family: "Rubik", sans-serif;
  transition: color 600ms;
}



  </style>
</head>

<body>
  <a href="#" class="btn" style="--clr:#7371fc;"><span>Magic Button</span></a>

  <a id="source-link" class="meta-link" href="https://t.me/+7yc_oGHnLJhlOWVl" target="_blank">
    <i class="fas fa-link"></i>
    <span class="roboto-mono">Join my Telegram</span>
</a>

<a id="yt-link" class="meta-link" href="https://www.youtube.com/@codewith_muhilan?sub_confirmation=1" target="_blank">
  <i class="fab fa-youtube"></i>
  <span>Subscribe my channel..❤</span>
</a>

  <script>
    let btn = document.querySelectorAll(".btn").forEach((btn) => {
  btn.addEventListener("mousemove", (e) => {
    let x = e.offsetX;
    let y = e.offsetY;
    let btnWidth = btn.clientWidth;
    let btnHeight = btn.clientHeight;
    let transX = x - btnWidth / 2;
    let transY = y - btnHeight / 2;
    btn.style.transform = `translateX(${transX}px) translateY(${transY}px)`;

    let mx = e.pageX - btn.offsetLeft;
    let my = e.pageY - btn.offsetTop;
    btn.style.setProperty("--x", mx + "px");
    btn.style.setProperty("--y", my + "px");
  });
  btn.addEventListener("mouseout", (e) => {
    btn.style.transform = "";
  });
});

  </script>
</body>

</html>



JOIN TELEGRAM 

FOLLOW ME ON INSTAGRAM 

Post a Comment

Previous Post Next Post