1129案例-走马灯,全民出游

这篇博客展示了两个HTML案例,一是走马灯效果,通过CSS实现图片向左平滑移动,实现产品展示区域的循环滚动;二是创建了动态云朵和底部元素的动画效果,利用CSS关键帧动画改变图片位置,营造出云朵飘动和底部元素上升的视觉效果,增强了页面的动态感和趣味性。
摘要由CSDN通过智能技术生成

案例走马灯

产品多,区域放不下

代码

</head>
<style>
    * {
        padding: 0;
        margin: 0;
    }
    li {
        list-style: none;
        
    }
    img {
        width: 200px;
    }
    .box {
        width: 600px;
        height: 112px;
        border: 5px solid gray;
        margin: 10px auto;
        /*溢出盒子外的不显示*/
        overflow: hidden;
    }
    .box ul {
        width: 2000px;
        animation: move 3s infinite ;
        
    }
    .box li {
        float: left;
    }

    /*定义动画位移ul,左侧移动7张图片,-1400px*/
    @keyframes move {
        to {
        transform: translateX(-1400px);
        }
    }
</style>
<body>
    <div class="box">
        <ul>
            <li><img src="./image/1.jpg" alt=""></li>
            <li><img src="./image/2.jpg" alt=""></li>
            <li><img src="./image/3.jpg" alt=""></li>
            <li><img src="./image/4.jpg" alt=""></li>
            <li><img src="./image/5.jpg" alt=""></li>
            <li><img src="./image/6.jpg" alt=""></li>
            <li><img src="./image/7.jpg" alt=""></li>
            <li><img src="./image/1.jpg" alt=""></li>
            <li><img src="./image/2.jpg" alt=""></li>
            <li><img src="./image/3.jpg" alt=""></li>
            <li><img src="./image/1.jpg" alt=""></li>
            <li><img src="./image/2.jpg" alt=""></li>
            <li><img src="./image/3.jpg" alt=""></li>
            <li><img src="./image/4.jpg" alt=""></li>
        </ul>
    </div>
</body>

效果,几个图动画向左移动

 案例全民出游

html

<body>
    <!--云朵图片-->
    <div class="cloud">
        <img src="./image/yun1.png" alt="">
        <img src="./image/yun2.png" alt="">
        <img src="./image/yun3.png" alt="">
    </div>

    <!--dibu-->
    <div class="bottom">
        <img src="./image/1.png" alt="">
        <img src="./image/2.png" alt="">
        <img src="./image/3.png" alt="">
        <img src="./image/4.png" alt="">
    </div>
</body>

css

* {
    margin: 0;
    padding: 0;
}
html {
    height: 100%;
}
body {
    height: 100%;
    background: url(./image/f1_1.jpg) no-repeat center 0;
    /*缩放背景图*/
    background-size: cover;
}

/*云朵*/
.cloud img {
    position: absolute;
    left: 50%;
    top: 0;
}

.cloud img:nth-child(1) {
    top: 20px;
    margin-left: -300px;
    animation: cloud 1s infinite alternate;
}
.cloud img:nth-child(2) {
    top: 200px;
    margin-left: -400px;
    animation: cloud 3s infinite;
}
.cloud img:nth-child(3) {
    top: 30px;
    margin-left: 200px;
    animation: cloud 2s infinite;
}

@keyframes cloud {
    to {
        transform: translateX(50px);
    }
}

/*底部*/
.bottom img {
    position: absolute;
    left: 50%;
    bottom: 35px;
}

.bottom img:nth-child(1) {
    bottom: 35px;
    left: 575px;
    animation: bottom 1s infinite;
}
.bottom img:nth-child(2) {
    bottom: 35px;
    left: 345px;
    animation: bottom 1s infinite 1s forwards;
}
.bottom img:nth-child(3) {
    bottom: 35px;
    left: 810px;
    animation: bottom 1s infinite 2s forwards;
}
.bottom img:nth-child(4) {
    bottom: 35px;
    left: 1042px;
    animation: bottom 1s infinite forwards;
}
@keyframes bottom {
    to {
        transform: translateY(-30px) ;
    }
}

 

Element UI中的走马灯(Carousel)是一个前端页面中广泛使用的功能,可以在有限的空间内循环播放同一类型的图片、文字等内容。Element UI是全球最受欢迎的Vue UI框架之一。 走马灯提供了多种配置选项,使得开发人员可以自定义走马灯的样式和行为。Element UI的走马灯组件可以通过简单的配置实现基础用法,包括自动播放、循环播放、切换速度等功能。 使用Element UI的走马灯组件可以轻松地在Vue的项目中实现走马灯效果,提升用户体验。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [解决Vue的项目使用Element ui 走马灯无法实现的问题](https://download.csdn.net/download/weixin_38678550/12924490)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Element UI 走马灯的使用](https://blog.csdn.net/weixin_40757930/article/details/128534315)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Element UI学习6--Carousel 走马灯](https://blog.csdn.net/hanrabbit/article/details/112788635)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值