css怎么实现文字无缝上下滚动
<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Document</title><style...
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style> *{ padding: 0; margin: 0; } .box{ width: 600px; height: 130px; border: 1px solid #ccc; box-shadow: 2px 2px 2px 0px #ccc; margin: 100px auto; overflow: hidden; } .a{ width: 150px; height: 130px; background: red; color: white; text-align: center; line-height: 130px; font-weight: bold; float: left; } ul{ list-style: none; float: left; padding-left: 40px; animation:roll 10s 12; } li{ line-height: 30px; } @keyframes roll{ 0%{ transform:translateY(0px); } 20%{ transform:translateY(-30px); } 45%{ transform:translateY(-60px); } 70%{ transform:translateY(-90px); } 80%{ transform:translateY(-120px); } 100%{ transform:translateY(-150px); } } </style></head><body> <div class="box"> <div class="a">头条</div> <ul> <li>新闻速递1</li> <li>新闻速递2</li> <li>新闻速递3</li> <li>新闻速递4</li> <li>新闻速递5</li> <li>新闻速递6</li> </ul> </div></body></html>我是这样写的,但是他滚动到了“6” 这里了下面是空白,怎么让他下面立马接着出现“1”
最好不要用js 展开
最好不要用js 展开
2个回答
展开全部
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159!DOCTYPEhtmlheadmetahttp-equiv="Content-Type"content="text/html;charset=gb2312"/title向上下左右不间断无缝滚动效果(兼容火狐和IE)/title/headbodydivid="colee"style="overflow:hidden;height:253px;width:410px;"divid="colee1"p此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/pp此处放文字。。。。。。。。。/p/divdivid="colee2"/div/divscriptvarspeed=30;varcolee2=document.getElementById("colee2");varcolee1=document.getElementById("colee1");varcolee=document.getElementById("colee");colee2.innerHTML=colee1.innerHTML;//克隆colee1为colee2functionMarquee1(){//当滚动至colee1与colee2交界时if(colee2.offsetTop-colee.scrollTop=0){colee.scrollTop-=colee1.offsetHeight;//colee跳到最顶端}else{colee.scrollTop++}}varMyMar1=setInterval(Marquee1,speed)//设置定时器//鼠标移上时清除定时器达到滚动停止的目的colee.onmouseover=function(){clearInterval(MyMar1)}//鼠标移开时重设定时器colee.onmouseout=function(){MyMar1=setInterval(Marquee1,speed)}/script!--向上滚动代码结束--!--下面是向下滚动代码--divid="colee_bottom"style="overflow:hidden;height:253px;width:410px;"divid="colee_bottom1"pimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/ppimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/divdivid="colee_bottom2"/div/divscriptvarspeed=30varcolee_bottom2=document.getElementById("colee_bottom2");varcolee_bottom1=document.getElementById("colee_bottom1");varcolee_bottom=document.getElementById("colee_bottom");colee_bottom2.innerHTML=colee_bottom1.innerHTMLcolee_bottom.scrollTop=colee_bottom.scrollHeightfunctionMarquee2(){if(colee_bottom1.offsetTop-colee_bottom.scrollTop=0)colee_bottom.scrollTop+=colee_bottom2.offsetHeightelse{colee_bottom.scrollTop--}}varMyMar2=setInterval(Marquee2,speed)colee_bottom.onmouseover=function(){clearInterval(MyMar2)}colee_bottom.onmouseout=function(){MyMar2=setInterval(Marquee2,speed)}/script!--向下滚动代码结束--!--下面是向左滚动代码--divid="colee_left"style="overflow:hidden;width:500px;"tablecellpadding="0"cellspacing="0"border="0"trtdid="colee_left1"valign="top"align="center"tablecellpadding="2"cellspacing="0"border="0"tralign="center"tdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/td/tr/table/tdtdid="colee_left2"valign="top"/td/tr/table/divscript//使用div时,请保证colee_left2与colee_left1是在同一行上.varspeed=30//速度数值越大速度越慢varcolee_left2=document.getElementById("colee_left2");varcolee_left1=document.getElementById("colee_left1");varcolee_left=document.getElementById("colee_left");colee_left2.innerHTML=colee_left1.innerHTMLfunctionMarquee3(){if(colee_left2.offsetWidth-colee_left.scrollLeft=0)//offsetWidth是对象的可见宽度colee_left.scrollLeft-=colee_left1.offsetWidth//scrollWidth是对象的实际内容的宽,不包边线宽度else{colee_left.scrollLeft++}}varMyMar3=setInterval(Marquee3,speed)colee_left.onmouseover=function(){clearInterval(MyMar3)}colee_left.onmouseout=function(){MyMar3=setInterval(Marquee3,speed)}/script!--向左滚动代码结束--!--下面是向右滚动代码--divid="colee_right"style="overflow:hidden;width:500px;"tablecellpadding="0"cellspacing="0"border="0"trtdid="colee_right1"valign="top"align="center"tablecellpadding="2"cellspacing="0"border="0"tralign="center"tdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/tdtdpimgsrc="/jscss/demoimg/200907/bg3.jpg"/p/td/tr/table/tdtdid="colee_right2"valign="top"/td/tr/table/divscriptvarspeed=30//速度数值越大速度越慢varcolee_right2=document.getElementById("colee_right2");varcolee_right1=document.getElementById("colee_right1");varcolee_right=document.getElementById("colee_right");colee_right2.innerHTML=colee_right1.innerHTMLfunctionMarquee4(){if(colee_right.scrollLeft=0)colee_right.scrollLeft+=colee_right2.offsetWidthelse{colee_right.scrollLeft--}}varMyMar4=setInterval(Marquee4,speed)colee_right.onmouseover=function(){clearInterval(MyMar4)}colee_right.onmouseout=function(){MyMar4=setInterval(Marquee4,speed)}/script!--向右滚动代码结束--/body/html常用JS图片、文字滚动(...大小:1.41K 已经过百度安全检测,放心下载点击下载
追问
这是JS的代码?我要的HTML的
追问
这是JS的代码?我要的HTML的
展开全部
@keyframes roll{
0%{ transform:translateY(0px); }
33.3%{ transform:translateY(-30px); }
66.7%{ transform:translateY(-60px); }
100%{ transform:translateY(0px); }
}
但是这样不用js去控制,有什么意义呢
追问
这样写的话是6下来了 1没有接到6 后面 循环滚动 ,谢谢了,我就是想要这么个效果。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询