过时
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> element is used to insert a scrolling area of text. You can control what happens when the text reaches the edges of its content area using its attributes.

DOM 接口 HTMLMarqueeElement

属性

behavior
Sets how the text is scrolled within the marquee. Possible values are scroll , slide and alternate . If no value is specified, the default value is scroll .
bgcolor

Sets the background color through color name or hexadecimal value.

direction
Sets the direction of the scrolling within the marquee. Possible values are left , right , up and down . If no value is specified, the default value is left .
height

Sets the height in pixels or percentage value.

hspace

Sets the horizontal 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

Sets the amount of scrolling at each interval in pixels. The default value is 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 被指定。
truespeed
默认情况下, scrolldelay values lower than 60 are ignored. If truespeed is present, those values are not ignored.
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()

Starts scrolling of the marquee.

stop()

Stops scrolling of the 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 实时标准
The definition of '<marquee>' in that specification.
实时标准 Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility. However, the development of the marquee features of CSS have since been abandoned .
HTML5
The definition of '<marquee>' in that specification.
推荐 Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility. However, the development of the marquee features of CSS have since been abandoned .

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
marquee 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 65
完整支持 65
部分支持 1 注意事项
注意事项 实现 HTMLDivElement 接口。
IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 65
完整支持 65
部分支持 4 注意事项
注意事项 实现 HTMLDivElement 接口。
Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
behavior 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
bgcolor 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
direction 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
height 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
hspace 弃用 Chrome 完整支持 Yes Edge 完整支持 ≤18 Firefox 完整支持 3 IE ? Opera 完整支持 Yes Safari ? WebView Android 完整支持 Yes Chrome Android 完整支持 Yes Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS ? Samsung Internet Android 完整支持 Yes
loop 弃用 Chrome 完整支持 Yes Edge 完整支持 ≤18 Firefox 完整支持 3 IE ? Opera 完整支持 Yes Safari ? WebView Android 完整支持 Yes Chrome Android 完整支持 Yes Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS ? Samsung Internet Android 完整支持 Yes
scrollamount 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
scrolldelay 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0
truespeed 弃用 Chrome 完整支持 Yes Edge 完整支持 12 Firefox 完整支持 3 IE 完整支持 4 Opera 完整支持 Yes Safari 不支持 No WebView Android 完整支持 Yes Chrome Android 完整支持 Yes Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS 不支持 No Samsung Internet Android 完整支持 Yes
vspace 弃用 Chrome 完整支持 Yes Edge 完整支持 ≤18 Firefox 完整支持 3 IE ? Opera 完整支持 Yes Safari ? WebView Android 完整支持 Yes Chrome Android 完整支持 Yes Firefox Android 完整支持 4 Opera Android 完整支持 Yes Safari iOS ? Samsung Internet Android 完整支持 Yes
width 弃用 Chrome 完整支持 1 Edge 完整支持 12 Firefox 完整支持 1 IE 完整支持 2 Opera 完整支持 7.2 Safari 完整支持 1.2 WebView Android 完整支持 1 Chrome Android 完整支持 18 Firefox Android 完整支持 4 Opera Android 完整支持 10.1 Safari iOS 完整支持 Yes Samsung Internet Android 完整支持 1.0

图例

完整支持

完整支持

不支持

不支持

兼容性未知 ?

兼容性未知

弃用。不要用于新网站。

弃用。不要用于新网站。

见实现注意事项。

见实现注意事项。

另请参阅

元数据

  • 最后修改: