温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

marquee元素怎么实现滚动字体与图片的效果

发布时间:2020-09-28 16:25:13 来源:亿速云 阅读:121 作者:小新 栏目:web开发

marquee元素怎么实现滚动字体与图片的效果?这个问题可能是我们日常学习或工作经常见到的。希望通过这个问题能让你收获颇深。下面是小编给大家带来的参考内容,让我们一起来看看吧!

marquee元素可以实现简单的字体(图片等)的滑动等效果:

<style type="text/css"> 
#div01{ 
width: 500px; 
} 
</style> 
<script type="text/javascript"> 
</script> 
<marquee behavior="alertnate"><font size=30 color='red'>www.baidu.com111</font></marquee> 
<marquee direction=right bgcolor='#ff2233' behavior="alertnate"><font size=30 color='blue'>www.baidu.com222</font></marquee> 
<marquee id="m3" direction=down bgcolor='#dbdbdb' height=50px hspace=20px vspace=20px behavior="alertnate" scrollLeft=left onmouseover="this.stop()" onmouseout="this.start()"><font size=30 color='blue'>www.baidu333.com</font></marquee> 
<marquee id="m4" direction=up bgcolor='#00dbdb' behavior="alertnate"><font size=30 color='blue'>www.baidu444.com</font></marquee>
<div id="div01"><marquee direction=right bgcolor='#ff2233' behavior="alertnate" scrolldelay=100><font size=30 color='blue'>www.baidu.com555</font></marquee></div> 
<input type="button" onclick="m3.stop();" value="m3.stop"></input> 
<input type="button" onclick="m3.start();" value="m3.start"></input> 
<button onclick="m4.stop();">m4.stop</button> 
<button onclick="m4.start();">m4.start</button>

direction 表示滚动的方向,值可以是left,right,up,down,默认为left
behavior 表示滚动的方式,值可以是scroll(连续滚动)slide(滑动一次)alternate(来回滚动)
loop 表示循环的次数,值是正整数,默认为无限循环
scrollamount 表示运动速度,值是正整数,默认为6
scrolldelay 表示停顿时间,值是正整数,默认为0,单位似乎是毫秒
align 表示元素的垂直对齐方式,值可以是top,middle,bottom,默认为middle
bgcolor 表示运动区域的背景色,值是16进制的RGB颜色,默认为白色
height、width 表示运动区域的高度和宽度,值是正整数(单位是像素)或百分数,默认width=100% height为标签内元素的高度
hspace、vspace 表示元素到区域边界的水平距离和垂直距离,值是正整数,单位是像素。
onmouseover=this.stop() onmouseout=this.start() 表示当鼠标以上区域的时候滚动停止,当鼠标移开的时候又继续滚动。
以下是设置点击按钮时m3、m4的滚动或停止:

<input type="button" onclick="m3.stop();" value="m3.stop"></input> 
<input type="button" onclick="m3.start();" value="m3.start"></input> 
<button onclick="m4.stop();">m4.stop</button> 
<button onclick="m4.start();">m4.start</button>

感谢各位的阅读!看完上述内容,你们对marquee元素怎么实现滚动字体与图片的效果大概了解了吗?希望文章内容对大家有所帮助。如果想了解更多相关文章内容,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI