css文字动画(自动换文字)
html:
<div class="content">
<div class="content__container">
<p class="content__container__text">
酒之
</p>
<ul class="content__container__list">
<li class="content__container__list__item">历史</li>
<li class="content__container__list__item">常识</li>
<li class="content__container__list__item">文化</li>
<li class="content__container__list__item">工艺</li>
<li class="content__container__list__item">典故</li>
</ul>
</div>
</div>
css:
body {
width: 100%;
height: 100%;
position: fixed;
background-color: #34495e;
}
.content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 160px;
overflow: hidden;
font-size: 35px;
line-height: 40px;
color: #ecf0f1;
}
.content__container {
font-weight: 600;
overflow: hidden;
height: 40px;
padding: 0 40px;
}
.content__container:after,
.content__container:before {
position: absolute;
top: 0;
color: #16a085;
font-size: 42px;
line-height: 40px;
animation-name: opacity;
animation-duration: 2s;
animation-iteration-count: infinite;
}
.content__container__text {
display: inline;
float: left;
margin: 0;
}
.content__container__list {
margin-top: 0;
padding-left: 110px;
text-align: left;
list-style: none;
animation-name: change;
animation-duration: 10s;
animation-iteration-count: infinite;
}
.content__container__list__item {
line-height: 40px;
margin: 0;
}
@keyframes opacity {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
@keyframes change {
0%,
100% {
transform: translate3d(0, 0, 0);
}
25%{
transform: translate3d(0, -25%, 0);
}
50% {
transform: translate3d(0, -50%, 0);
}
75% {
transform: translate3d(0, -75%, 0);
}
}
最新文章
- Oracle 表和表数据恢复
- js的Array的map和sort实现方法
- swift学习记录之代理
- JS中的prototype///////////////////////////z
- Java异步IO/NIO
- php提高效率
- 外网SSH访问内网LINUX的N种方法
- Scrapy爬虫实例——校花网
- 干货:MySQL 索引原理及慢查询优化
- 关于ORACLE的SQL语句拼接、替换、截取、排序,联表等...~持续汇总~
- 汉诺塔I &;&; II
- 设置js的ctx
- JQuery编写自己的插件(七)
- 5 款最新的 jQuery 图片裁剪插件
- LeetCode DB : Delete Duplicate Emails
- Linux命令之stty
- 网易 2016 实习研发project师 3道 编程题
- soj2012.King(有向图+蛋疼得一逼)
- Set集合之TreeSet类
- ant design pro (十三)advanced 错误处理