MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

<marquee>

翻譯不完整。請協助 翻譯此英文文件

已過時
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
Sets the number of times the marquee will scroll. If no value is specified, the default value is −1, which means the marquee will scroll continuously.
scrollamount
以像素為單位,設定捲動的間隔量。預設值為 6。
scrolldelay
Sets the interval between each scroll movement in milliseconds. The default value is 85. Note that any value smaller than 60 is ignored and the value 60 is used instead, unless truespeed is specified.
truespeed
scrolldelay 預設上會忽略低於 60 的值。但如果有 truespeed 的話,就不會忽略此值。
vspace
Sets the vertical margin in pixels or percentage value.
width
Sets the width in pixels or percentage value.

事件處理器

onbounce
Fires when the marquee has reached the end of its scroll position. It can only fire when the behavior attribute is set to alternate.
onfinish
Fires when the marquee has finished the amount of scrolling that is set by the loop attribute. It can only fire when the loop attribute is set to some number that is greater than 0.
onstart
Fires when the marquee starts scrolling.

方法

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>

規範

規範 狀態 註解
WHATWG HTML Living Standard
The definition of '<marquee>' in that specification.
Living Standard Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility.
HTML5
The definition of '<marquee>' in that specification.
Recommendation Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility.

瀏覽器相容性

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 1.0 (Yes) 1.0 (1.7 or earlier) 2.0 7.2 1.2
truespeed attribute No support (Yes) 3.0 (1.9) 4.0 No support No support
hspace/vspace attribute ? (Yes) 3.0 (1.9) ? ? ?
loop attribute ? (Yes) 3.0 (1.9) ? ? ?
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? (Yes) 1.0 (1.0) ? ? ?
truespeed attribute ? (Yes) 1.0 (1.0) ? ? ?
hspace/vspace attribute ? (Yes) 1.0 (1.0) ? ? ?
loop attribute ? (Yes) 1.0 (1.0) ? ? ?

文件標籤與貢獻者

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