js+css实现魔杖跟随鼠标悬浮图片卡片效果代码
代码语言:html
所属分类:悬停
代码描述:js+css实现魔杖跟随鼠标悬浮图片卡片效果代码
代码标签: js css 魔杖 跟随 鼠标 悬浮 图片 卡片
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> body { background: rgb(2, 6, 23); height: 100vh; overflow: hidden; display: grid; place-items: center; } * { margin: 0; padding: 0; box-sizing: border-box; } #wand { width: 10vmin; aspect-ratio: 1 / 10; background: linear-gradient( to right, rgb(26 24 28) 10%, rgb(42 40 44) 45% 55%, rgb(26 24 28) 90% ); position: absolute; left: 5%; top: 20%; translate: -50%; rotate: -3deg; z-index: 100; border-radius: 3vmin; box-shadow: 0vmin 1vmin 4vmin rgb(0 0 0 / 80%); overflow: hidden; } #wand > .cap { height: 20%; width: 100%; background: linear-gradient( to right, rgb(212 221 236) 10%, rgb(255 255 255) 45% 55%, rgb(212 221 236) 90% ); } #tiles { display: flex; } .tile { display: grid; place-items: center; width: 38vmin; aspect-ratio: 1; background-color: rgb(31, 41, 55); border-radius: 6vmin; box-shadow: 0vmin 3vmin 6vmin rgb(0 0 0 / 25%), inset 0vmin 0.5vmin 1vmin rgb(255 255 255 / 15%); position: relative; overflow: hidden; } .tile:nth-child(1) { rotate: 3deg; z-index: 3; } .tile:nth-child(2) { rotate: -2deg; z-index: 2; } .tile:nth-child(3) { rotate: 5deg; z-index: 1; } .tile:is(:nth-child(2), :nth-child(3)) { margin-left: -10vmin; } .tile > i { font-size: 15vmin; color: rgb(255 255 255 / 10%); } .tile > img { height: 100%; aspect-ratio: 1; position: absolute; left: 0px; top: 0px; object-fit: cover; opacity: var(--opacity); filter: blur(calc(var(--blur) * 10px)); } </style> </head> <body > <div id="wand"> <div class="cap"></div> </div> <div id="tiles"> <div class="tile"> <i class="fa-solid fa-image"></i> <img src="//repo.bfw.wiki/bfwrepo/image/6374680372999.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" /> </div> <div class="tile"> <i class="fa-solid fa-image&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0