詳解html中的marquee屬性

該標簽不是HTML3.2的一部分,并且只支持MSIE3以后內(nèi)核,所以如果你使用非IE內(nèi)核瀏覽器(如:Netscape)可能無法看到下面一些很有意思的效果
該標簽是個容器標簽
語法:
<marquee></marquee>
以下是一個最簡單的例子:
代碼如下:
<marquee><font size=+3 color=red>Hello, World</font></marquee>
下面這兩個事件經(jīng)常用到:
onMouseOut="this.start()" :用來設置鼠標移出該區(qū)域時繼續(xù)滾動
onMouseOver="this.stop()":用來設置鼠標移入該區(qū)域時停止?jié)L動
代碼如下:
<marquee onMouseOut="this.start()" onMouseOver="this.stop()">onMouseOut="this.start()" :用來設置鼠標移出該區(qū)域時繼續(xù)滾動 onMouseOver="this.stop()":用來設置鼠標移入該區(qū)域時停止?jié)L動</marquee>
這是一個完整的例子:
代碼如下:
<marquee id="affiche" align="left" behavior="scroll" bgcolor="#FF0000" direction="up" height="300" width="200" hspace="50" vspace="20" loop="-1" scrollamount="10" scrolldelay="100" onMouseOut="this.start()" onMouseOver="this.stop()"> 這是一個完整的例子 </marquee>
該標簽支持的屬性多達11個:
align
設定<marquee>標簽內(nèi)容的對齊方式
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
設定滾動的次數(shù),當loop=-1表示一直滾動下去,默認為-1
代碼如下:
<marquee loop="-1" bgcolor="#CCCCCC">我會不停地走。</marquee> <p> </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>
以上所述是小編給大家介紹的詳解html中的marquee屬性,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關文章
HTML標簽marquee實現(xiàn)滾動效果的簡單方法(必看)
下面小編就為大家?guī)硪黄狧TML標簽marquee實現(xiàn)滾動效果的簡單方法(必看)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧,祝大家游戲愉2016-09-19- Marquee.dll2016-07-31
HTML標簽marquee實現(xiàn)多種滾動效果(無需JS控制)
本文給大家介紹使用html標簽 - <marquee></marquee>可以實現(xiàn)多種滾動效果,無需js控制,非常不錯,具有參考借鑒價值,感興趣的朋友一起看下吧2016-07-05- div圖片marquee無縫連接如何實現(xiàn)?下面有個不錯的方法,大家可以按照操作即可2014-02-17
HTMl 中marquee標簽實現(xiàn)無縫滾動跑馬燈效果
這篇文章主要介紹了HTMl 中marquee標簽實現(xiàn)無縫滾動跑馬燈效果,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-03-07