• css-导航光标下划线跟随鼠标效果


    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style>
            ul {
                display: flex;
            }
    
            li {
                position: relative;
                padding: 20px;
                transition: 0.2s all linear;
                cursor: pointer;
                list-style: none;
            }
    
            li::before {
                content: '';
                position: absolute;
                top: 0;
                left: 100%;
                width: 0;
                height: 100%;
                border-bottom: 2px solid #000;
                transition: 0.2s all linear;
            }
    
            li:hover::before {
                width: 100%;
                left: 0;
                top: 0;
                transition-delay: 0.1s;
                border-bottom-color: #000;
                z-index: -1;
            }
    
            li:hover~li::before {
                left: 0;
            }
    
            li:active {
                background-color: #000;
                color: #fff;
            }
        </style>
    </head>
    
    <body>
        <ul>
            <li>导航栏1</li>
            <li>导航栏2</li>
            <li>导航栏3</li>
            <li>导航栏4</li>
            <li>导航栏5</li>
        </ul>
    </body>
    
    </html>
    View Code
  • 相关阅读:
    2-4安卓自学
    2-3安卓自学
    2-2安卓自学
    2-1安卓自学
    20210121 Sqlit数据库
    20210119 Sqlit数据库
    20210118 android学习
    20210117 android学习
    20210115 android学习
    20210114 android学习
  • 原文地址:https://www.cnblogs.com/huangmin1992/p/12205920.html
Copyright © 2020-2023  润新知