html marquee標(biāo)簽使用示例介紹
發(fā)布時(shí)間:2014-05-13 17:28:17 作者:佚名
我要評(píng)論

這篇文章主要介紹了html marquee標(biāo)簽的使用,比較適合新手朋友,marquee的屬性比較多,本文通過(guò)示例為大家詳細(xì)展示
該標(biāo)簽不是HTML3.2的一部分,并且只支持MSIE3以后內(nèi)核,所以如果你使用非IE內(nèi)核瀏覽器(如:Netscape)可能無(wú)法看到下面一些很有意思的效果
該標(biāo)簽是個(gè)容器標(biāo)簽
Marquee 公告滾動(dòng)代碼
最簡(jiǎn)單的網(wǎng)站公告滾動(dòng)代碼 ,基于Marquee走馬燈,豎直向上滾動(dòng),Table表格形式,不懂CSS也能用。
提示:您可以先修改部分代碼再運(yùn)行
語(yǔ)法:
<marquee></marquee>
以下是一個(gè)最簡(jiǎn)單的例子:
代碼如下:
<marquee><font size=+3 color=red>Hello, World</font></marquee>
下面這兩個(gè)事件經(jīng)常用到:
onMouseOut="this.start()" :用來(lái)設(shè)置鼠標(biāo)移出該區(qū)域時(shí)繼續(xù)滾動(dòng)
onMouseOver="this.stop()":用來(lái)設(shè)置鼠標(biāo)移入該區(qū)域時(shí)停止?jié)L動(dòng)
代碼如下:
<marquee onMouseOut="this.start()" onMouseOver="this.stop()">onMouseOut="this.start()" :用來(lái)設(shè)置鼠標(biāo)移出該區(qū)域時(shí)繼續(xù)滾動(dòng) onMouseOver="this.stop()":用來(lái)設(shè)置鼠標(biāo)移入該區(qū)域時(shí)停止?jié)L動(dòng)</marquee>
這是一個(gè)完整的例子:
代碼如下:
<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()">
這是一個(gè)完整的例子
</marquee>
該標(biāo)簽支持的屬性多達(dá)11個(gè):
align
設(shè)定<marquee>標(biāo)簽內(nèi)容的對(duì)齊方式
absbottom:絕對(duì)底部對(duì)齊(與g、p等字母的最下端對(duì)齊)
absmiddle:絕對(duì)中央對(duì)齊
baseline:底線對(duì)齊
bottom:底部對(duì)齊(默認(rèn))
left:左對(duì)齊
middle:中間對(duì)齊
right:右對(duì)齊
texttop:頂線對(duì)齊
top:頂部對(duì)齊
代碼如下:
<marquee align="absbottom">align="absbottom":絕對(duì)底部對(duì)齊(與g、p等字母的最下端對(duì)齊)。 </marquee>
<marquee align="absmiddle">align="absmiddle": 絕對(duì)中央對(duì)齊。 </marquee>
<marquee align="baseline">align="baseline": 底線對(duì)齊。 </marquee>
<marquee align="bottom">align="bottom": 底部對(duì)齊(默認(rèn))。 </marquee>
<marquee align="left">align="left": 左對(duì)齊。 </marquee>
<marquee align="middle">align="middle": 中間對(duì)齊。 </marquee>
<marquee align="right">align="right": 右對(duì)齊。 </marquee>
<marquee align="texttop">align="texttop": 頂線對(duì)齊。 </marquee>
<marquee align="top">align="top": 頂部對(duì)齊。 </marquee>
behavior
設(shè)定滾動(dòng)的方式:
alternate: 表示在兩端之間來(lái)回滾動(dòng)。
scroll: 表示由一端滾動(dòng)到另一端,會(huì)重復(fù)。
slide: 表示由一端滾動(dòng)到另一端,不會(huì)重復(fù)。
代碼如下:
<marquee behavior="alternate">alternate:表示在兩端之間來(lái)回滾動(dòng)。 </marquee>
<marquee behavior="scroll">scroll:表示由一端滾動(dòng)到另一端,會(huì)重復(fù)。</marquee>
<marquee behavior="slide">slide: 表示由一端滾動(dòng)到另一端,不會(huì)重復(fù)。</marquee>
bgcolor
設(shè)定活動(dòng)字幕的背景顏色,背景顏色可用RGB、16進(jìn)制值的格式或顏色名稱來(lái)設(shè)定。
代碼如下:
<marquee bgcolor="#006699">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="#006699"</marquee>
<marquee bgcolor="RGB(10%,50%,100%,)">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="rgb(10%,50%,100%,)"</marquee>
<marquee bgcolor="red">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="red"</marquee>
direction
設(shè)定活動(dòng)字幕的滾動(dòng)方向
代碼如下:
<marquee direction="down">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="down":向下</marquee>
<marquee direction="left">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="left":向左</marquee>
<marquee direction="right">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="right":向右</marquee>
<marquee direction="up">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="up":向上</marquee>
height
設(shè)定活動(dòng)字幕的高度
代碼如下:
<marquee height="500" direction="down" bgcolor="#CCCCCC">設(shè)定活動(dòng)字幕的高度height="500"</marquee>
width
設(shè)定活動(dòng)字幕的寬度
代碼如下:
<marquee width="500" bgcolor="#CCCCCC">設(shè)定活動(dòng)字幕的寬度width="500"</marquee>
hspace
設(shè)定活動(dòng)字幕里所在的位置距離父容器水平邊框的距離
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
設(shè)定活動(dòng)字幕里所在的位置距離父容器垂直邊框的距離
This controls the vertical(垂直) space around the display box.
代碼如下:
<marquee vspace="100" bgcolor="#CCCCCC">hspace="100"</marquee>
loop
設(shè)定滾動(dòng)的次數(shù),當(dāng)loop=-1表示一直滾動(dòng)下去,默認(rèn)為-1
代碼如下:
<marquee loop="-1" bgcolor="#CCCCCC">我會(huì)不停地走。</marquee>
<p> </p>
<marquee loop="2" bgcolor="#CCCCCC">我只走兩次哦</marquee>
scrollamount
設(shè)定活動(dòng)字幕的滾動(dòng)速度,單位pixels
代碼如下:
<marquee scrollamount="10" >scrollamount="10" </marquee>
<marquee scrollamount="20" >scrollamount="20" </marquee>
<marquee scrollamount="30" >scrollamount="30" </marquee>
scrolldelay
設(shè)定活動(dòng)字幕滾動(dòng)兩次之間的延遲時(shí)間,單位millisecond(毫秒)
值大了會(huì)有一步一停頓的效果
代碼如下:
<marquee scrolldelay="10" >scrolldelay="10" </marquee>
<marquee scrolldelay="100" > scrolldelay="100"</marquee>
<marquee scrolldelay="1000">scrolldelay="1000" </marquee>
該標(biāo)簽是個(gè)容器標(biāo)簽
Marquee 公告滾動(dòng)代碼
最簡(jiǎn)單的網(wǎng)站公告滾動(dòng)代碼 ,基于Marquee走馬燈,豎直向上滾動(dòng),Table表格形式,不懂CSS也能用。
提示:您可以先修改部分代碼再運(yùn)行
語(yǔ)法:
<marquee></marquee>
以下是一個(gè)最簡(jiǎn)單的例子:
代碼如下:
復(fù)制代碼
代碼如下:<marquee><font size=+3 color=red>Hello, World</font></marquee>
下面這兩個(gè)事件經(jīng)常用到:
onMouseOut="this.start()" :用來(lái)設(shè)置鼠標(biāo)移出該區(qū)域時(shí)繼續(xù)滾動(dòng)
onMouseOver="this.stop()":用來(lái)設(shè)置鼠標(biāo)移入該區(qū)域時(shí)停止?jié)L動(dòng)
代碼如下:
復(fù)制代碼
代碼如下:<marquee onMouseOut="this.start()" onMouseOver="this.stop()">onMouseOut="this.start()" :用來(lái)設(shè)置鼠標(biāo)移出該區(qū)域時(shí)繼續(xù)滾動(dòng) onMouseOver="this.stop()":用來(lái)設(shè)置鼠標(biāo)移入該區(qū)域時(shí)停止?jié)L動(dòng)</marquee>
這是一個(gè)完整的例子:
代碼如下:
復(fù)制代碼
代碼如下:<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()">
這是一個(gè)完整的例子
</marquee>
該標(biāo)簽支持的屬性多達(dá)11個(gè):
align
設(shè)定<marquee>標(biāo)簽內(nèi)容的對(duì)齊方式
absbottom:絕對(duì)底部對(duì)齊(與g、p等字母的最下端對(duì)齊)
absmiddle:絕對(duì)中央對(duì)齊
baseline:底線對(duì)齊
bottom:底部對(duì)齊(默認(rèn))
left:左對(duì)齊
middle:中間對(duì)齊
right:右對(duì)齊
texttop:頂線對(duì)齊
top:頂部對(duì)齊
代碼如下:
復(fù)制代碼
代碼如下:<marquee align="absbottom">align="absbottom":絕對(duì)底部對(duì)齊(與g、p等字母的最下端對(duì)齊)。 </marquee>
<marquee align="absmiddle">align="absmiddle": 絕對(duì)中央對(duì)齊。 </marquee>
<marquee align="baseline">align="baseline": 底線對(duì)齊。 </marquee>
<marquee align="bottom">align="bottom": 底部對(duì)齊(默認(rèn))。 </marquee>
<marquee align="left">align="left": 左對(duì)齊。 </marquee>
<marquee align="middle">align="middle": 中間對(duì)齊。 </marquee>
<marquee align="right">align="right": 右對(duì)齊。 </marquee>
<marquee align="texttop">align="texttop": 頂線對(duì)齊。 </marquee>
<marquee align="top">align="top": 頂部對(duì)齊。 </marquee>
behavior
設(shè)定滾動(dòng)的方式:
alternate: 表示在兩端之間來(lái)回滾動(dòng)。
scroll: 表示由一端滾動(dòng)到另一端,會(huì)重復(fù)。
slide: 表示由一端滾動(dòng)到另一端,不會(huì)重復(fù)。
代碼如下:
復(fù)制代碼
代碼如下:<marquee behavior="alternate">alternate:表示在兩端之間來(lái)回滾動(dòng)。 </marquee>
<marquee behavior="scroll">scroll:表示由一端滾動(dòng)到另一端,會(huì)重復(fù)。</marquee>
<marquee behavior="slide">slide: 表示由一端滾動(dòng)到另一端,不會(huì)重復(fù)。</marquee>
bgcolor
設(shè)定活動(dòng)字幕的背景顏色,背景顏色可用RGB、16進(jìn)制值的格式或顏色名稱來(lái)設(shè)定。
代碼如下:
復(fù)制代碼
代碼如下:<marquee bgcolor="#006699">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="#006699"</marquee>
<marquee bgcolor="RGB(10%,50%,100%,)">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="rgb(10%,50%,100%,)"</marquee>
<marquee bgcolor="red">設(shè)定活動(dòng)字幕的背景顏色 bgcolor="red"</marquee>
direction
設(shè)定活動(dòng)字幕的滾動(dòng)方向
代碼如下:
復(fù)制代碼
代碼如下:<marquee direction="down">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="down":向下</marquee>
<marquee direction="left">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="left":向左</marquee>
<marquee direction="right">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="right":向右</marquee>
<marquee direction="up">設(shè)定活動(dòng)字幕的滾動(dòng)方向direction="up":向上</marquee>
height
設(shè)定活動(dòng)字幕的高度
代碼如下:
復(fù)制代碼
代碼如下:<marquee height="500" direction="down" bgcolor="#CCCCCC">設(shè)定活動(dòng)字幕的高度height="500"</marquee>
width
設(shè)定活動(dòng)字幕的寬度
代碼如下:
復(fù)制代碼
代碼如下:<marquee width="500" bgcolor="#CCCCCC">設(shè)定活動(dòng)字幕的寬度width="500"</marquee>
hspace
設(shè)定活動(dòng)字幕里所在的位置距離父容器水平邊框的距離
This controls the horizontal(水平)space around the display box.
代碼如下:
復(fù)制代碼
代碼如下:<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
設(shè)定活動(dòng)字幕里所在的位置距離父容器垂直邊框的距離
This controls the vertical(垂直) space around the display box.
代碼如下:
復(fù)制代碼
代碼如下:<marquee vspace="100" bgcolor="#CCCCCC">hspace="100"</marquee>
loop
設(shè)定滾動(dòng)的次數(shù),當(dāng)loop=-1表示一直滾動(dòng)下去,默認(rèn)為-1
代碼如下:
復(fù)制代碼
代碼如下:<marquee loop="-1" bgcolor="#CCCCCC">我會(huì)不停地走。</marquee>
<p> </p>
<marquee loop="2" bgcolor="#CCCCCC">我只走兩次哦</marquee>
scrollamount
設(shè)定活動(dòng)字幕的滾動(dòng)速度,單位pixels
代碼如下:
復(fù)制代碼
代碼如下:<marquee scrollamount="10" >scrollamount="10" </marquee>
<marquee scrollamount="20" >scrollamount="20" </marquee>
<marquee scrollamount="30" >scrollamount="30" </marquee>
scrolldelay
設(shè)定活動(dòng)字幕滾動(dòng)兩次之間的延遲時(shí)間,單位millisecond(毫秒)
值大了會(huì)有一步一停頓的效果
代碼如下:
復(fù)制代碼
代碼如下:<marquee scrolldelay="10" >scrolldelay="10" </marquee>
<marquee scrolldelay="100" > scrolldelay="100"</marquee>
<marquee scrolldelay="1000">scrolldelay="1000" </marquee>
相關(guān)文章
HTML標(biāo)簽marquee實(shí)現(xiàn)滾動(dòng)效果的簡(jiǎn)單方法(必看)
下面小編就為大家?guī)?lái)一篇HTML標(biāo)簽marquee實(shí)現(xiàn)滾動(dòng)效果的簡(jiǎn)單方法(必看)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧,祝大家游戲愉2016-09-19HTML標(biāo)簽marquee實(shí)現(xiàn)多種滾動(dòng)效果(無(wú)需JS控制)
本文給大家介紹使用html標(biāo)簽 - <marquee></marquee>可以實(shí)現(xiàn)多種滾動(dòng)效果,無(wú)需js控制,非常不錯(cuò),具有參考借鑒價(jià)值,感興趣的朋友一起看下吧2016-07-05html借助marquee實(shí)現(xiàn)文字左右滾動(dòng)
實(shí)現(xiàn)文字左右滾動(dòng)的方法有兩種,一是借助于marquee、二是普通的實(shí)現(xiàn),兩種方法各有優(yōu)缺,看看測(cè)試下再做選擇2014-08-24- 使用移動(dòng)屬性marquee,不僅僅可以舞動(dòng)你的文字,還可以應(yīng)用于圖片,表格等等2012-03-14
- HTML(Marquee字符片段滾動(dòng)),建議用js實(shí)現(xiàn)的代碼。因?yàn)榭梢詫?shí)現(xiàn)不間斷的滾動(dòng)。不過(guò)學(xué)習(xí)用用還是不錯(cuò)的。2009-10-29
- Marquee被W3C拋棄了。這句話其實(shí)這是錯(cuò)誤的,為什么呢,因?yàn)镸arquee從來(lái)都沒(méi)有被W3C視 為正式標(biāo)簽使用。2009-09-22
網(wǎng)頁(yè)HTML代碼:滾動(dòng)文字的制作
本節(jié)筆者講述HTML代碼中比較特殊的標(biāo)簽,它能使網(wǎng)頁(yè)中的文字滾動(dòng),并且可以控制其滾動(dòng)的屬性。 制作滾動(dòng)文字 通過(guò)本章前面的學(xué)習(xí),讀者已經(jīng)能夠很好地2009-04-02- 這篇文章主要介紹了詳解html中的marquee屬性的相關(guān)資料,需要的朋友可以參考下2017-02-06