marquee标签详解

博主最近在写一个比较简单的网页,想要实现滚动字幕的效果,从网上也查了一些资料,有一些是利用JS实现的,效果有好有坏但都比较复杂。偶然间看到了marquee标签,发现使用marquee标签实现这个效果很简单效果也不错。

marquee介绍

<marquee>hello world</marquee>

常用两个事件
onMouseOut=”this.start()” 鼠标移除该区域开始移动
onMouseOver=”this.stop()” 鼠标移到该区域停止移动

<marquee> onMouseOut="this.start()" onMouseOver="this.stop()">常用的两个事件</marquee>

* 属性*
behavior设定滚动的方式:
alternate:来回滚动
scroll:重复滚动
slide:不重复滚动

<marquee behavior="alternate">来回滚动。 </marquee>

<marquee behavior="scroll">重复滚动。</marquee>

<marquee behavior="slide">不重复滚动。</marquee>

活动字幕背景颜色
使用bgcolor背景颜色:
有三种方式

<marquee bgcolor="#006699">设定活动字幕的背景颜色</marquee>

<marquee bgcolor="RGB(10%,50%,100%,)">设定活动字幕的背景颜色 </marquee>

<marquee bgcolor="red">设定活动字幕的背景颜色</marquee>

设置字幕的滚动方向
使用direction:

<marquee direction="down">设定活动字幕的滚动方向向下</marquee>

<marquee direction="left">设定活动字幕的滚动方向向左</marquee>

<marquee direction="right">设定活动字幕的滚动方向向右</marquee>

<marquee direction="up">设定活动字幕的滚动方向向上</marquee>

设置宽度与高度
使用height设置高度,width设置宽度:

<marquee height="500" direction="down" bgcolor="#CCCCCC">设定活动字幕的高度</marquee>
<marquee width="500" bgcolor="#CCCCCC">设定活动字幕的宽度</marquee>

设置滚动次数与速度
loop设定滚动次数:
loop==-1表示一直滚动下去,默认为-1

<marquee loop="-1" bgcolor="#CCCCCC">我会不停地走。</marquee>

<marquee loop="2" bgcolor="#CCCCCC">我只走两次哦</marquee>

scrollamount设定滚动速度:单位pix

<marquee scrollamount="10" >scrollamount="10" </marquee>

<marquee scrollamount="20" >scrollamount="20" </marquee>

<marquee scrollamount="30" >scrollamount="30" </marquee>

scrolldelay设置滚动两次的延迟时间,单位为毫秒

<marquee scrolldelay="10" >scrolldelay="10" </marquee>

<marquee scrolldelay="100" > scrolldelay="100"</marquee>

<marquee scrolldelay="1000">scrolldelay="1000" </marquee>

关于图片
marquee也可以使图片滚动

<marquee>
<img border=0 src="...jpg" >
</marquee>

实例

<marquee behavior="scroll" direction=left height=82 width=500 scrollamount=10 scrolldelay=9 width="100%" bgcolor="white"> 
<img border=0 src="images/hemei_02.jpg" > 
    </marquee>

赶快自己试试效果吧!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值