該標籤是個容器標籤
語法:
以下是一個最簡單的例子:
代碼如下:
onMouseOut="this.start()" :用來設置鼠標移出該區域時繼續滾動
onMouseOver="this.stop()":用來設置鼠標移入該區域時停止滾動
代碼如下:
這是一個完整的例子
</marquee>
該標籤支持的屬性多達11個:
align
設定<marquee>標籤內容的對齊方式
absbottom:絕對底部對齊(與g、p等字母的最下端對齊)
absmiddle:絕對中央對齊
baseline:底線對齊
bottom:底部對齊(默認)
left:左對齊
middle:中間對齊
right:右對齊
texttop:頂線對齊
top:頂部對齊
代碼如下:
<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="scroll">scroll:表示由一端滾動到另一端,會重複。</marquee>
<marquee behavior="slide">slide: 表示由一端滾動到另一端,不會重複。</marquee>
bgcolor
設定活動字幕的背景顏色,背景顏色可用RGB、16進制值的格式或顏色名稱來設定。
<marquee bgcolor="RGB(10%,50%,100%,)">設定活動字幕的背景顏色 bgcolor="rgb(10%,50%,100%,)"</marquee>
<marquee bgcolor="red">設定活動字幕的背景顏色 bgcolor="red"</marquee>
direction
設定活動字幕的滾動方向
<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>
設定活動字幕裏所在的位置距離父容器水平邊框的距離
This controls the horizontal(水平)space around the display box.
<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=-1表示一直滾動下去,默認爲-1
<p> </p>
<marquee loop="2" bgcolor="#CCCCCC">我只走兩次哦</marquee>
scrollamount
設定活動字幕的滾動速度,單位pixels
<marquee scrollamount="20" >scrollamount="20" </marquee>
<marquee scrollamount="30" >scrollamount="30" </marquee>
scrolldelay
設定活動字幕滾動兩次之間的延遲時間,單位millisecond(毫秒)
值大了會有一步一停頓的效果
<marquee scrolldelay="100" > scrolldelay="100"</marquee>
<marquee scrolldelay="1000">scrolldelay="1000" </marquee>