css照片遮罩动画效果代码
代码语言:html
所属分类:悬停
代码描述:css照片遮罩动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> #btn--yp { box-sizing: content-box; position: fixed; z-index: 9; bottom: 1em; right: 1em; border: solid 1em transparent; width: 4.625em; height: 3.25em; font: 16px/1.25 trebuchet ms, sans-serif; text-indent: 200vw; text-shadow: none; filter: grayscale(1) drop-shadow(0 0 1px #e8e0e0); transition: 0.5s; white-space: nowrap; } #btn--yp:before { box-sizing: inherit; position: absolute; left: 0; bottom: 100%; margin: 1em -0.5em; padding: 0.5em; width: 100%; border-radius: 5px; background: #e8e0e0; color: #000; text-align: center; text-decoration: none; text-indent: 0vw; white-space: normal; animation: float 1s ease-in-out infinite alternate; content: attr(data-txt); } #btn--yp:hover, #btn--yp:focus { outline: none; filter: grayscale(0) drop-shadow(0 0 1px crimson); } @keyframes float { to { transform: translateY(0.75em); } } @property --hov { syntax: "<number>"; initial-value: 0; inherits: false; } body { box-sizing: border-box; display: grid; grid-gap: 0.5em; grid-template-columns: repeat(var(--m), max-content); place-content: center; margin: 0; padding: 0.5em; min-height: 100vh; } .tile { --list: rgba(102, 102, 102, 0) calc(var(--hov)*100%), #666666 0; padding: min(6.5em, calc(.5*(100vw - (var(--m) + 1)*0.5em)/var(--m))); background: var(--grd), var(--url) 50%/cover, var(--grd); background-blend-mode: multiply, luminosity; transition: --hov 0.5s; } .tile:hover { --hov: 1 ; } [data-typ="0"] { --grd: linear-gradient(var(--ang), var(--list)) ; } [data-typ="1"] { --grd: radial-gradient(at var(--oxy), var(--list)) ; } </style> </head> <body style="--m: 3"> <div class="tile" data-typ="1" role="img" aria-label="Amur leopard" style="--oxy: 0 0; --url: url(//repo.bfw.wiki/bfwrepo/image/5d65ea7d8bc8b.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90)"></div> <div class="tile" data-typ="0" role=&q.........完整代码请登录后点击上方下载按钮下载查看
网友评论0