js+css实现魔法按钮跟随鼠标效果代码

代码语言:html

所属分类:其他

代码描述:js+css实现魔法按钮跟随鼠标效果代码

代码标签: js css 魔法 按钮 跟随 鼠标

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&amp;display=swap'>
  
<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: #7371fc;
}

.btn{
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center
  width: 200px;
  padding: 20px 25px;
  border-radius: 50px;
  background: #f5efff;
  box-shadow: 1px 1px 20px 1px #f5efff;
  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: #7371fc;
 transition: 0.5s;
}


.btn:hover span{
  color: #f5efff;
}

.btn::before{
  content: '';
  position: absolute;
  left: var(--x);
  top: var(--y);
  trans.........完整代码请登录后点击上方下载按钮下载查看

网友评论0