PHP技术论坛

搜索
查看: 988|回复: 0
打印 上一主题 下一主题

纯CSS实现上下广告文字滚动效果

[复制链接]

83

主题

88

帖子

411

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
411
跳转到指定楼层
楼主
发表于 2017-8-30 17:07:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. .wrap{height:30px;overflow: hidden;position: absolute;top:30;left: 100;width: 100%}
  2.       p{margin:0;height: 30px;width: 100%}
  3.       .content p{
  4.         position: absolute;
  5.       }
  6.       @-webkit-keyframes anim1{
  7.         0% {top: 30px;opacity: 1}
  8.         50% {top: -30px;opacity: 1}
  9.         75% {top: -30px ;opacity: 0}
  10.         100%{top:30px;opacity: 0}
  11.       }
  12.       @-webkit-keyframes anim2{
  13.      
  14.         0% {top: -30px;opacity: 0}
  15.         25% {top: 30px;opacity: 0}
  16.         50% {top: 30px;opacity: 1}
  17.         100%{top: -30px;opacity: 1}
  18.       }

  19.       .content p:nth-child(1){background-color: red;}
  20.       .content p:nth-child(2){background-color: yellow;}
  21.       .content p:nth-child(1){
  22.         
  23.         -webkit-animation: anim1 3s linear infinite;
  24.       }
  25.       
  26.       .content p:nth-child(2){
  27.    
  28.         -webkit-animation: anim2 3s linear infinite;
  29.       }
复制代码
  1.   <div class="wrap">
  2.     <div class="content">
  3. <p>第一行数据</p>
  4. <p>第二行数据</p>

  5.     </div>
  6.   </div>
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|PHP  

GMT+8, 2024-4-20 00:12 , Processed in 0.072862 second(s), 33 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表