已過時
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

HTML <marquee> 元素用作插入一段文字的捲動區域。你可以透過屬性,控制文字在到達邊緣後的應對動作。

<marquee> 元素已過時,也絕對不該用。儘管某些瀏覽器還會支援,但那不是必需的。

屬性

behavior
設定文字如何在 marquee 內捲動。可用值為 scrollslidealternate。若無指定,預設值為 scroll
bgcolor
透過色彩名或十六進位值指定背景顏色。
direction
設定 marquee 內的捲動方向。可用值為 leftrightupdown。若無指定,預設值為 left
height
設定像素或百分比高度。
hspace
設定橫向外邊(margin)
loop
設定 marquee 捲動的次數。若無指定,預設值為 -1,意思是的 marquee 將持續捲動。
scrollamount
以像素為單位,設定捲動的間隔量。預設值為 6。
scrolldelay
設定每次捲動時之間間隔的毫秒。預設值為 85。請注意,除非指定了 truespeed,否則小於 60 的數字會被忽略,並值使用 60。
truespeed
scrolldelay 預設上會忽略低於 60 的值。但如果有 truespeed 的話,就不會忽略此值。
vspace
以像素或百分比值設置垂直邊距。
width
設置以像素或百分比值為單位的寬度。

事件處理器

onbounce
marquee 滾動到結尾時觸發。只能在 behavior 屬性設置為 alternate 時觸發。
onfinish
marquee 完成 loop 屬性的設定值時觸發。只能在 loop 屬性設為大於 0 的數字時觸發。
onstart
marquee 開始捲動時觸發。

方法

start()
開始 marquee 的捲動
stop()
停止 marquee 的捲動

示例

<marquee>This text will scroll from right to left</marquee>

<marquee direction="up">This text will scroll from bottom to top</marquee>

<marquee direction="down" width="250" height="200" behavior="alternate" style="border:solid">
  <marquee behavior="alternate">
    This text will bounce
  </marquee>
</marquee>

規範

規範 狀態 註解
HTML Living Standard
The definition of '<marquee>' in that specification.
Living Standard 為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。
HTML5
The definition of '<marquee>' in that specification.
Recommendation 為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。

瀏覽器相容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Deprecated
Chrome Full support 1Edge Full support YesFirefox Partial support 1
Notes
Partial support 1
Notes
Notes Implements the HTMLDivElement interface.
IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Partial support 4
Notes
Partial support 4
Notes
Notes Implements the HTMLDivElement interface.
Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
behavior
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
bgcolor
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
direction
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
height
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
hspace
Deprecated
Chrome Full support YesEdge Full support YesFirefox Full support 3IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
loop
Deprecated
Chrome Full support YesEdge Full support YesFirefox Full support 3IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
scrollamount
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
scrolldelay
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?
truespeed
Deprecated
Chrome Full support YesEdge Full support YesFirefox Full support 3IE Full support 4Opera Full support YesSafari No support NoWebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS No support NoSamsung Internet Android No support No
vspace
Deprecated
Chrome Full support YesEdge Full support YesFirefox Full support 3IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS ? Samsung Internet Android ?
width
Deprecated
Chrome Full support 1Edge Full support YesFirefox Full support 1IE Full support 2Opera Full support 7.2Safari Full support 1.2WebView Android Full support 1Chrome Android Full support 18Edge Mobile Full support YesFirefox Android Full support 4Opera Android Full support 10.1Safari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Partial support  
Partial support
No support  
No support
Compatibility unknown  
Compatibility unknown
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.

文件標籤與貢獻者

此頁面的貢獻者: iigmir
最近更新: iigmir,