js实现三维倾斜图文卡片悬浮效果代码
代码语言:html
所属分类:悬停
代码描述:js实现三维倾斜图文卡片悬浮效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.googleapis.com/css2?family=Prompt:wght@200;600&display=swap"); * { margin: 0; padding: 0; box-sizing: border-box; color: inherit; } html, body { background: #0c0e10; color: #e9e9e9; font-family: "Prompt", sans-serif; } html .container, body .container { min-height: 100vh; display: grid; place-items: center; padding: 40px; } html .container .card, body .container .card { width: 100%; max-width: 600px; height: 400px; background-repeat: no-repeat; background-size: cover; background-position: center; background-image: url("//repo.bfw.wiki/bfwrepo/image/5e62ef20b92ee.png"); display: grid; place-items: center; position: relative; transition: transform 0.3s ease; transform-style: preserve-3d; will-change: transform; overflow: hidden; cursor: pointer; } html .container .card:before, body .container .card:before { content: ""; background: rgba(0, 0, 0, 0.4); position: absolute; height: 100%; width: 100%; left: 0; right: 0; top: 0; bottom: 0; z-index: 0; } html .container .card:after, body .container .card:after { content: ""; background: radial-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0)); position: absolute; padding-top: 220%; width: 220%; left: 0; top: 0; z-index: 2; transform: translate(-50%, -50%); top: var(--reflect-top, 0); left: var(--reflect-left, 0); opacity: var(--reflect-power, 0); transition: opacity 0.3s ease; } html .container .card:hover, body .container .card:hover { transition-duration: 0.1s; } html .container .card:hover:after, body .container .card:hover:after { transition-duration: 0.1s; } html .container .card p, body .container .card p { font-size: 60px; tra.........完整代码请登录后点击上方下载按钮下载查看
网友评论0