css实现鼠标悬浮图片边角三维层叠动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现鼠标悬浮图片边角三维层叠动画效果代码

代码标签: css 鼠标 悬浮 图片 边角 三维 层叠

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

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">



    <style>
        *,
        *::before,
        *::after {
          box-sizing: border-box;
          font-family: "Noto Sans Mono", monospace;
        }
        
        body,
        html {
          -webkit-text-size-adjust: 100%;
          -webkit-tap-highlight-color: transparent;
          -webkit-font-smoothing: antialiased;
          text-rendering: optimizeLegibility;
          font-size: 12pt;
          line-height: 18pt;
          font-weight: 400;
          color: lawngreen;
        }
        
        body {
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          width: 100vw;
          height: 100vh;
          overflow: hidden;
          background: #222;
          margin: 0;
          padding: 0;
        }
        
        @keyframes dots {
          0% {
            background-position: 30px 30px, 50px 50px;
          }
          50% {
            background-position: 0px 0px, 15px 15px;
          }
          100% {
            background-position: 30px 30px, 50px 50px;
          }
        }
        
        div:nth-child(1) {
          position: relative;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          background: black;
          width: 400px;
          height: 200px;
          box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px,
            rgba(0, 0, 0, 0.3) 0px 7px 13px -3px;
          border-radius: 10px;
          transform-style: preserve-3d;
          outline: 1px solid lawngreen;
          outline-offset: -15px;
          outline-style: groove;
          z-index: 1;
          transition: all 0.3s ease-in-out;
        }
        
        div > div:nth-child(2),
        div > div:nth-child(3),
        div:nth-child(1)::before,
        div:nth-child(1)::after {
          position: absolute;
          width: 60px;
          height: 60px;
          border-radius: 100px;
          z-index: -1;
          content: "";
          border: 2px solid lawngreen;
          color: lawngreen;
          transition: all 0.3s ease-in-out;
        }
        
        div:nth-child(1)::before {
          top: -15px;
          right: -15px;
        }
        
        div:nth-child(1)::after {
          bottom: -15px;
          left: -15px;
        }
        
        div > div:nth-child(2) {
          top: -15px;
          left: -15px;
        }
        
        div > div:nth-child(3) {
          bottom: -15px;
          right: -15px;
        }
        
        div > picture {
          position: relative;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: center;
          width: 100%;
          height: auto;
          overflow: hidden;
          border-radius: 10px;
          outline: 1px.........完整代码请登录后点击上方下载按钮下载查看

网友评论0