html球体涨水

简单

代码

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            margin-left: 200px;
            border: 1px solid red;
            border-radius: 50%;
            position: relative;
            overflow: hidden;
        }

        div::before {
            content: "";
            position: absolute;
            top: 100%;
            left: 0;
            background-color: red;
            width: 200px;
            height: 200px;
            border-radius: 50%;
            transition: 0.5s;
        }

        div:hover:before {
            top: 0;
        }
    </style>
</head>

<body>
    <div></div>
</body>

</html>

 


复杂

代码

 

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container {
            width: 1000px;
            height: 580px;
            margin: 50px auto;
            border: 1px solid green;
            position: relative;
        }

        .top {
            margin: 0 auto 0px;
            padding: 10px 0;
            background: deepskyblue;
            color: #fff;
        }

        .dajianshi {
            width: 100%;
            height: 400px;
            position: relative;
        }

        ul {
            display: flex;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }

        ul li {
            list-style: none;
        }

        ul li span {
            width: 120px;
            height: 120px;
            background-color: #fff;
            text-align: center;
            line-height: 120px;
            margin: 0 10px;
            display: block;
            border-radius: 50%;
            position: relative;
            overflow: hidden;
            border: 3px solid #cde;
            z-index: 1;
        }

        ul li span:before {
            content: "";
            position: absolute;
            top: 100%;
            left: 0;
            width: 100%;
            height: 100%;
            transition: 0.5s;
            z-index: 2;
        }

        ul li span:hover:before {
            top: 0;
        }

        ul li:nth-child(1) span:before {
            background: red;
        }

        ul li:nth-child(2) span:before {
            background: orange;
        }

        ul li:nth-child(3) span:before {
            background: yellow;
        }

        ul li:nth-child(4) span:before {
            background: green;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="top">
            <h3>球体涨水的效果</h3>
        </div>
        <div class="dajianshi">
            <ul>
                <li>
                    <span></span>
                </li>
                <li>
                    <span></span>
                </li>
                <li>
                    <span></span>
                </li>
                <li>
                    <span></span>
                </li>
            </ul>
        </div>
    </div>
</body>

</html>

相关推荐

  1. js实现给html

    2024-04-20 18:12:01       37 阅读
  2. 代码

    2024-04-20 18:12:01       36 阅读
  3. 排队接

    2024-04-20 18:12:01       12 阅读
  4. Android中球体碰撞代码分享-kotlin,入门版

    2024-04-20 18:12:01       10 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-20 18:12:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-20 18:12:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-20 18:12:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-20 18:12:01       20 阅读

热门阅读

  1. scilab笔记

    2024-04-20 18:12:01       13 阅读
  2. 图搜索算法详解

    2024-04-20 18:12:01       14 阅读
  3. 基于simulink的配网自动化仿真

    2024-04-20 18:12:01       15 阅读
  4. html用法

    2024-04-20 18:12:01       13 阅读
  5. Nginx 负载均衡配置

    2024-04-20 18:12:01       17 阅读
  6. 09篇 docker命令详解

    2024-04-20 18:12:01       13 阅读
  7. 在单片机中什么是FLASH

    2024-04-20 18:12:01       18 阅读