css实现文字悬浮图片遮罩动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现文字悬浮图片遮罩动画效果代码

代码标签: css 文字 悬浮 遮罩 图片

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

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

<head>
    <meta charset="UTF-8">
    <style>
        @import url("https://fonts.googleapis.com/css2?family=Work+Sans:wght@900&display=swap");
    * {
      box-sizing: border-box;
    }
    *::before, *::after {
      box-sizing: border-box;
    }
    
    body {
      font-family: "Work Sans", sans-serif;
      font-size: 1em;
      margin: 0;
      background: #f2f0ed;
      overflow: hidden;
    }
    
    .container {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100%;
      min-height: 100vh;
    }
    
    a {
      text-decoration: none;
    }
    
    .link {
      z-index: 1;
      position: relative;
      display: inline-block;
      font-size: 3em;
      color: #808080;
      text-transform: uppercase;
      transition: color 275ms ease;
    }
    .link:hover {
      color: #333;
    }
    .link:hover ~ .hover-container .link-text {
      opacity: 1;
    }
    .link:hover ~ .hover-container .image-container {
      opacity: 1;
    }
    
    .link-text {
      z-index: 2;
      position: absolute;
      display: flex;
      justify-content: center;
      align-items: center;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      font-size: 3em;
      color: #fff;
      text-transform: uppercase;
      pointer-events: none;
      -webkit-clip-path: circle(75px at var(--x) var(--y));
              clip-path: circle(75px at var(--x) var(--y));
      opacity: 0;
      transition: opacity 250ms ease;
    }
    
    .image-container {
      z-index: -2;
      position: absolute;
      top: 0;
      l.........完整代码请登录后点击上方下载按钮下载查看

网友评论0