marquee参数详解

以下以文字来示范marquee的各个参数:

文字滚动是由<marquee></marquee>控制的。marquee的参数如下:

1、方向 <direction=#> #=left, right
如:<marquee direction=left>啦啦啦,我从右向左移!</marquee>
<marquee direction=right>啦啦啦,我从左向右移!</marquee>

2、方式 <bihavior=#> #=scroll, slide, alternate
如:<marquee behavior=scroll>啦啦啦,我一圈一圈绕着走!</marquee>
<marquee behavior=slide>啦啦啦,我只走一次就歇了!</marquee>
<marquee behavior=alternate>啦啦啦,我来回走耶!</marquee>

3、循环 <loop=#> #=次数;若未指定则循环不止(infinite)
如:<marquee loop=3 width=50% behavior=scroll>啦啦啦,我只走 3 趟哟!</marquee>
<marquee loop=3 width=50% behavior=slide>啦啦啦,我只走 3 趟哟!</marquee>
<marquee loop=3 width=50% behavior=alternate>啦啦啦,我只走 3 趟哟!</marquee>

4、速度 <scrollamount=#>
如:<marquee scrollamount=20>啦啦啦,我走得好快哟!</marquee>

5、延时 <scrolldelay=#>
如: <marquee scrolldelay=500 scrollamount=100>啦啦啦,我走一步,停一停!</marquee>

6、对齐方式(Align) <align=#> #=top, middle, bottom
如:<font size=6>
<marquee align=# width=400>啦啦啦,我会移动耶!</marquee>
</font>
7、底色 <bgcolor=#>
#=rrggbb 16 进制数码,或者是下列预定义色彩:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua

如:<marquee bgcolor=aaaaee>啦啦啦,我会移动耶!</marquee>

8、面积 <height=# width=#>
如:<marquee height=40 width=50% bgcolor=aaeeaa> 啦啦啦,我会移动耶!</marquee>

9、空白(Margins)<hspace=# vspace=#>

<marquee   id="scrollarea"   direction="up"   scrolldelay="10"   scrollamount="1"   width="150"   height="80"   οnmοuseοver="this.stop();"   οnmοuseοut="this.start();">
------------------------------------------------------------------------------------------------------------------------------

<marquee></marquee>

以下是一个最简单的例子:

代码如下:

<marquee><font size=+3 color=red>Hello, World</font></marquee>

 

下面这两个事件经常用到:

onMouseOut="this.start()" :用来设置鼠标移出该区域时继续滚动

onMouseOver="this.stop()":用来设置鼠标移入该区域时停止滚动

代码如下:

<marquee >onMouseOut="this.start()" :用来设置鼠标移出该区域时继续滚动:用来设置鼠标移入该区域时停止滚动</marquee>

 

这是一个完整的例子:

代码如下:

<marquee align="left" behavior="scroll" bgcolor="#FF0000" direction="up" height="300" width="200" hspace="50" vspace="20" loop="-1" scrollamount="10" scrolldelay="100" >

这是一个完整的例子

</marquee>

 

该标签支持的属性多达11个:

 

align

设定<marquee>标签内容的对齐方式

absbottom:绝对底部对齐(与g、p等字母的最下端对齐)

absmiddle:绝对中央对齐

baseline:底线对齐

bottom:底部对齐(默认)

left:左对齐

middle:中间对齐

right:右对齐

texttop:顶线对齐

top:顶部对齐

代码如下:

<marquee align="absbottom">align="absbottom":绝对底部对齐(与g、p等字母的最下端对齐)。 </marquee>

<marquee align="absmiddle">align="absmiddle": 绝对中央对齐。 </marquee>

<marquee align="baseline">align="baseline": 底线对齐。 </marquee>

<marquee align="bottom">align="bottom": 底部对齐(默认)。 </marquee>

<marquee align="left">align="left": 左对齐。 </marquee>

<marquee align="middle">align="middle": 中间对齐。 </marquee>

<marquee align="right">align="right": 右对齐。 </marquee>

<marquee align="texttop">align="texttop": 顶线对齐。 </marquee>

<marquee align="top">align="top":顶部对齐。 </marquee>

 

behavior

设定滚动的方式:

alternate: 表示在两端之间来回滚动。

scroll: 表示由一端滚动到另一端,会重复。

slide: 表示由一端滚动到另一端,不会重复。

代码如下:

<marquee behavior="alternate">alternate:表示在两端之间来回滚动。 </marquee>

<marquee behavior="scroll">scroll:表示由一端滚动到另一端,会重复。</marquee>

<marquee behavior="slide">slide:表示由一端滚动到另一端,不会重复。</marquee>

 

bgcolor

设定活动字幕的背景颜色,背景颜色可用RGB、16进制值的格式或颜色名称来设定。

代码如下:

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

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

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

 

direction

设定活动字幕的滚动方向

代码如下:

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

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

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

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

 

height

设定活动字幕的高度

代码如下:

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

 

width

设定活动字幕的宽度

代码如下:

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

 

hspace

设定活动字幕里所在的位置距离父容器水平边框的距离

This controls the horizontal(水平)space around the display box.

代码如下:

<table width="500" border="1" align="center" cellpadding="0" cellspacing="0">

    <tr>

      <td><marquee hspace="100" bgcolor="#CCCCCC">hspace="100"</marquee></td>

    </tr>

</table>

 

vspace

设定活动字幕里所在的位置距离父容器垂直边框的距离

This controls the vertical(垂直) space around the display box.

代码如下:

<marquee vspace="100" bgcolor="#CCCCCC">hspace="100"</marquee>

 

loop

设定滚动的次数,当loop=-1表示一直滚动下去,默认为-1

代码如下:

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

<p>&nbsp;</p>

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

 

scrollamount

设定活动字幕的滚动速度,单位pixels

代码如下:

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

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

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

 

scrolldelay

设定活动字幕滚动两次之间的延迟时间,单位millisecond(毫秒)

值大了会有一步一停顿的效果

代码如下:

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

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

<marquee scrolldelay="1000">scrolldelay="1000" </marquee>
-------------------------------------------------------------------------------------------------------------------------------
啦啦啦,真的会动耶!

瞧,简单吧?不过,以上例子只是使用了marquee的默认用法。我们加入相应的参数,它的移动方法就有所不同了。

参数一:direction

direction的英文意思就是方向。这个参数的取值有四个:left(左)、right(右)、up(上)、down(下)。

例:
向上移动


向上移动
参数二:behavior

移动方式。值:scroll(循环移动)、slide(只移动一个回合)、alternate(来回移动)。

例: 哈哈,我来回走!


哈哈,我来回走!

累!我只走一次!


累!我只走一次!

参数三:loop

循环。若未指定则循环不止(infinite),其值取数值。例:

我只走三次哦


我只走三次哦

参数四:scrollamount

移动速度。值取正整数。数值越大,速度越快。例:

看,我走多快!


看,我走多快!

参数五:scrolldelay

延时。数值。例:

我走一走,停一停


我走一走,停一停

参数六:bgcolor

底色。例: 看到了吧?有底色!


看到了吧?有底色!

参数七:width和height

就是移动的宽度与高度了。例:

这个面积不够我移动!

这个面积不够我移动!

其他参数:

空白(Margins)
对齐方式(Align)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值