marquee标签并不是W3cchool所推荐的标签,但是各大浏览器对这个标签支持性还是非常好,也非常好用,这里就对这个标签进行一下简单介绍。
marquee标签常用属性
behavior属性
设置滚动类型:slide到边界就停止 alternate滚到边界就弹回
loop属性
设置滚动次数,默认-1,无限滚动
scrollamount属性 设置滚动的速度,值是正整数,默认为6
direction属性 设置滚动方向 (up down left right)
onmouseover/onmouseout属性
onmouseover=this.stop() onmouseout=this.start() 表示当鼠标以上区域的时候滚动停止,当鼠标移开的时候又继续滚动,两者常配合使用。
scrolldelay
****属性
设置每次滚动时的时间间隔(以毫秒为单位)。默认值为 85。请注意, 除非指定 truespeed 值,否则将忽略任何小于 60 的值,并改为使用 60。
示例代码:
<marquee scrollamount = "1">正宗好凉茶,正宗好声音</marquee>
<marquee direction = "right" scrollamount = "50">还是好听的声音</marquee>
<marquee loop = "1">百雀羚草本,天然不刺激</marquee>
<marquee direction = "up">中国电信天翼飞Young邀您参与我们的节目互动</marquee>
<marquee>天翼好网络,传递好声音</marquee>
<marquee behavior = "slide" scrolldelay = 200>赢取飞Young</marquee>
<marquee behavior = "alternate">五千元纯流量大礼包</marquee>
<marquee onmouseover = this.stop() onmouseout = this.start()>
<img src="11.jpg" width="40">
</marquee>
效果展示:

参考链接:https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/marquee#%E5%B1%9E%E6%80%A7
网友评论