css 信息栏上下轮播

css实现信息栏上下滚动轮播

    <div class="container">
        <div class="tagline">
            <span class="change-container">
                <span class="changing">
                    张**   189******17  2小时前
                </span>
                <span class="changing">
                    陈**   137******06  3分钟前
                </span>
                <span class="changing">
                    徐**   150******82   2天前

                </span>
                <span class="changing">
                    屈**  131******75  1天前
                </span>
                <span class="changing">
                    第**  199******99  3分钟前
                </span>
            </span>
        </div>
    </div>
* {
	margin: 0;
	padding: 0;
}
.container {
	 background: #eee;
	 margin-top: 10px;
	 text-align: center;
	 height: 1.9375rem;
	 line-height: 1.9375rem;
	 margin-bottom: 10px;
}
.tagline {
   text-align: center;
}

.change-container {
   position: relative;
   display: inline-block;
   width: 100%;
   height: 1.9375rem;
   text-align: center;
   margin-top: -5px;
}

/* 执行动画所有时间以及样式 */
.changing {
   position: absolute;
   overflow: hidden;
   display: inline-block;
   width: 100%;
   left: 0;
   bottom: 0;
   height: 0;
   opacity: 0;
   font-size: 16px;
   line-height: 16px;
   text-rendering: optimizeLegibility;
   -webkit-animation: revealNextWord 10s ease-in-out infinite;
   animation: revealNextWord 10s ease-in-out infinite;
}
/* 子类执行动画时间 */
.changing:nth-child(2) {
   -webkit-animation-delay: 2s;
   animation-delay: 2s;
}

.changing:nth-child(3) {
   -webkit-animation-delay: 4s;
   animation-delay: 4s;
}

.changing:nth-child(4) {
   -webkit-animation-delay: 6s;
   animation-delay: 6s;
}

.changing:nth-child(5) {
   -webkit-animation-delay: 8s;
   animation-delay: 8s;
}
/* 子类弹出动画效果 */
@-webkit-keyframes revealNextWord {
   0% {
       opacity: 0.3;
       height: 0;
   }

   10% {
       opacity: 1;
       height: 1.2em;
   }

   20% {
       opacity: 1;
       height: 1.2em;
   }

   28% {
       opacity: 0;
       height: 2em;
   }

   100% {
       opacity: 0;
   }
}

@keyframes revealNextWord {
   0% {
       opacity: 0.3;
       height: 0;
   }

   10% {
       opacity: 1;
       height: 1.2em;
   }

   20% {
       opacity: 1;
       height: 1.2em;
   }

   28% {
       opacity: 0;
       height: 2em;
   }

   100% {
       opacity: 0;
   }
}
效果图

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值