<marquee></marquee>標簽可實現文字滾動效果
如:
<marquee><font size=+3 color=red>Hello, World</font></marquee>
可實現文字從右向左滾動的效果
<marquee></marquee>標簽常用兩個鼠標事件:
onMouseOut="this.start()" :用來設置鼠標移出該區域時繼續滾動 onMouseOver="this.stop()":用來設置鼠標移入該區域時停止滾動
如:
<marquee onMouseOut="this.start()" onMouseOver="this.stop()">
onMouseOut="this.start()" :當鼠標移出該區域時繼續滾動 onMouseOver="this.stop()":當鼠標移入該區域時停止滾動
</marquee>
屬性
1、align屬性值
align 表示元素的水平對齊方式,值可以是
absbottom:絕對底部對齊(與g、p等字母的最下端對齊),
absmiddle:絕對中央對齊,
baseline:底線對齊,
bottom:底部對齊(默認),
left:左對齊,
middle:中間對齊,
right:右對齊,
texttop:頂線對齊,
top:頂部對齊
valign屬性值
valign 表示元素的垂直對齊方式,值可以是top,middle,bottom,默認為middle
如:
<marquee align="absbottom">align屬性值 </marquee>
2、behavior屬性值
behavior 表示滾動的方式,值可以是
scroll(連續滾動)
slide(滑動一次)
alternate(來回滾動)
如:<marquee behavior="#">behavior屬值</marquee>
3、bgcolor 屬性值
bgcolor 表示運動區域的背景色,值是16進制、RGB顏色,默認為白色
RGB顏色值 輸入不限制格式,只要包含3個合格的整數即可。例如:rgb(255, 0, 0)、255,0,255、254,234,0、255 0 255
如:<marquee bgcolor="aaaaee">小A博客導航</marquee>
4、direction屬性值
direction 表示滾動的方向,值可以是left,right,up,down,默認為left
如:<marquee direction="#">direction屬性值</marquee>
5、height、width屬性值
height、width 表示運動區域的高度和寬度,值是正整數(單位是像素)或百分數,默認width=100% height為標簽內元素的高度
6、hspace、vspace屬性值
hspace、vspace 表示元素到區域邊界的水平距離和垂直距離,值是正整數,單位是像素。
如:<marquee vspace="100" hspace="100" bgcolor="#CCCCCC">hspace、vspace屬性值</marquee>
7、loop屬性值
loop 表示循環的次數,值是正整數,默認為無限循環(等於-1也表示無限循環)
<marquee loop="#" behavior="scroll">loop屬性值</marquee>
8、scrollamount屬性值
scrollamount 表示運動速度,值是正整數,默認為6
如:<marquee scrollamount="20">scrollamount屬性值</marquee>
9、scrolldelay屬性值
scrolldelay 表示停頓時間,值是正整數,默認為0,單位是毫秒
如: <marquee scrolldelay="500" scrollamount="100">scrolldelay屬性值</marquee>
多條文字循環滾動
<marquee direction="up" height="25" scrollamount="2" onMouseOut="this.start()" onMouseOver="this.stop()"> <table width="100%" border="0" cellpadding="2" cellspacing="0"> <tr> <td align="center"> <table width="100%" border="0" cellpadding="2" cellspacing="0"> <tr> <td align="center"> <font color="#FFFFF"> <a href="#" target="_blank">這是第1行數據</a><br> <a href="#" target="_blank">這是第2行數據</a><br> <a href="#" target="_blank">這是第3行數據</a><br> <a href="#" target="_blank">這是第4行數據</a><br> <a href="#" target="_blank">這是第5行數據</a> </font> </td> </tr> </table> </td> </tr> </table> </marquee>