我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
Obsolete
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.
Summary
The HTML <marquee>
element is used to insert a scrolling area of text.
Attributes
behavior
- Sets how the text is scrolled within the marquee. Possible values are
scroll
,slide
andalternate
. If no value is specified, the default value isscroll
. 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
anddown
. If no value is specified, the default value isleft
. 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
is specified. truespeed
- By default,
scrolldelay
values lower than 60 are ignored. Iftruespeed
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.
Event handlers
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.
Methods
- start
- Starts scrolling of the marquee.
- stop
- Stops scrolling of the marquee.
Examples
<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>
Specifications
Specification | Status | Comment |
---|---|---|
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. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | 2.0 | 7.2 | 1.2 |
truespeed attribute |
No support | 3.0 (1.9) | 4.0 | No support | No support |
hspace/vspace attribute |
? | 3.0 (1.9) | ? | ? | ? |
loop attribute |
? | 3.0 (1.9) | ? | ? | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ? | 1.0 (1.0) | ? | ? | ? |
truespeed attribute |
? | 1.0 (1.0) | ? | ? | ? |
hspace/vspace attribute |
? | 1.0 (1.0) | ? | ? | ? |
loop attribute |
? | 1.0 (1.0) | ? | ? | ? |