学习17

倾斜效果

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>倾斜效果</title>
    <style>
      div {
        margin: 100px auto;
        width: 100px;
        height: 200px;
        background-color: pink;
        transition: all 0.5s;
      }

      div:hover {
        transform: skew(30deg);
        transform: skew(-30deg);
      }
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>

渐变线性

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        width: 200px;
        height: 200px;
        background-color: green;
        background-image: linear-gradient(
          red,
          green
        );
        background-image: linear-gradient(
          to right,
          red,
          green
        );
        background-image: linear-gradient(
          45deg,
          red,
          green
        );
        background-image: linear-gradient(
          red 80%,
          green
        );
      }
    </style>
  </head>
  <body>
    <div></div>
  </body>
</html>

案例产品展示

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>产品展示效果</title>
    <style>
      .box {
        position: relative;
        width: 300px;
        height: 212px;
      }

      .box img {
        width: 300px;
      }

      .box .title {
        position: absolute;
        left: 15px;
        bottom: 20px;
        z-index: 2;
        width: 260px;
        color: #fff;
        font-size: 20px;
        font-weight: 700;
      }

      .mask {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-image: linear-gradient(
            transparent,
            rgba(0,0,0,0.5)
        );
        opacity: 0;

        transition: all .5s;
      }

      .box:hover .mask {
        opacity: 1;
      }
    </style>
  </head>

  <body>
    <div class="box">
      <img src="./images/product.jpeg" alt="" />
      <div class="title">OceanStor Pacific 海量存储斩获2021 Interop金奖</div>
      <div class="mask"></div>
    </div>
  </body>
</html>

渐变径向

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 100px;
      height: 100px;
      background-color: pink; 
      border-radius: 50%;
      background-image: radial-gradient(
        50px at center center,
        red,
        pink
      );
      background-image: radial-gradient(
        50px 20px at center center,
        red,
        pink
      );
      background-image: radial-gradient(
        50px at 50px 30px,
        red,
        pink 50%
      );
    }

    button {
      width: 100px;
      height: 40px;
      background-color: green;
      border: 0;
      border-radius: 5px;
      color: #fff;
      background-image: radial-gradient(
        30px at 30px 20px,
        rgba(255, 255, 255, 0.2),
        transparent
      );
    }
  </style>
</head>
<body>
  <div></div>
  <button>按钮</button>
</body>
</html>
posted @ 2025-02-15 00:15  haoyinuo  阅读(23)  评论(0)    收藏  举报