前端 - div里有个p标签,想a:hover时先div展开完了再显示p可以怎么做?
伊谢尔伦
伊谢尔伦 2017-04-17 11:43:38
[CSS3讨论组]
<a href="#">hover
        <p class="p2">
            <p>qwerqwerqwer</p>
        </p>
    </a>
a:hover .p2{
        animation: 0.5s p2 ease-in forwards;    
    }
    a:hover p{
        display: block;
    }
    @keyframes p2{
        0%{height: 0; }
        100%{height: 200px; }
    } 
    .p2{
        width: 200px;
        background-color: red;
        
    }
    p{
        display: none;
    }
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(2)
PHP中文网
a:hover .p2{
        animation: 2.5s p2 ease-in forwards;    
    }
    a:hover p{
        display: block;
        animation: 0.5s p1 ease-in forwards;    
        animation-delay:2.5s;
    }
    @keyframes p2{
        0%{height: 0; }
        100%{height: 200px; }
    } 
    @keyframes p1{
        0%{opacity: 0; }
        100%{opacity: 1; }
    } 
    .p2{
        width: 200px;
        background-color: red;
        
    }
    p{
        opacity: 0;
        display: none;
    }
天蓬老师
a:hover .p2{
        animation: 0.5s p2 ease-in forwards;    
    }
    a:hover p{
        animation: 0.5s p ease-in forwards;    
    }
    @keyframes p2{
        0%{height: 0; }
        100%{height: 200px; }
    } 
    @keyframes p{
      0%{opacity:0}
      100%{opacity:1}
    }
    .p2{
        width: 200px;
        background-color: red;
        
    }
    p{
        display: block;
        opacity:0;
    }

给p也加动画

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号