{{HTMLRef}}
{{obsolete_header}}
Summary概述
The HTML <marquee>
element is used to insert a scrolling area of text.
html的marquee元素用于插入滚动文本。
Attributes属性
- {{htmlattrdef("behavior滚动方式")}}
- Sets how the text is scrolled within the marquee.
- 设置文本在marquee中如何滚动。
- Possible values are
scroll
,slide
andalternate
. - 可用值为
scroll
循环滚动,slide
只滚动一次就停止 和alternate
来回交替进行滚动。 - If no value is specified, the default value is
scroll
.
如果没有特别指定,默认值是scroll
循环滚动。
- {{htmlattrdef("bgcolor背景色")}}
- Sets the background color through color name or hexadecimal value.
通过颜色名或十六进制值来设置背景色。
- {{htmlattrdef("direction方向")}}
- Sets the direction of the scrolling within the marquee.
设置marquee内的滚动方向
- Possible values are
left
,right
,up
anddown
.
可用值为左右上下。
- If no value is specified, the default value is
left
. - {{htmlattrdef("height")}}
- Sets the height in pixels or percentage value.
- {{htmlattrdef("hspace")}}
- Sets the horizontal margin
- {{htmlattrdef("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.
- {{htmlattrdef("scrollamount")}}
- Sets the amount of scrolling at each interval in pixels. The default value is 6.
- {{htmlattrdef("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. - {{htmlattrdef("truespeed")}}
- By default,
scrolldelay
values lower than 60 are ignored. Iftruespeed
is present, those values are not ignored. - {{htmlattrdef("vspace")}}
- Sets the vertical margin in pixels or percentage value.
- {{htmlattrdef("width")}}
- Sets the width in pixels or percentage value.
Event handlers
- {{htmlattrdef("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
. - {{htmlattrdef("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.
- {{htmlattrdef("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>
{{EmbedLiveSample("Examples", 600, 450)}}
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'obsolete.html#the-marquee-element-2', '<marquee>')}} | {{Spec2('HTML WHATWG')}} | Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility. |
{{SpecName('HTML5 W3C', 'obsolete.html#the-marquee-element-0', '<marquee>')}} | {{Spec2('HTML5 W3C')}} | Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 1.0 | {{CompatGeckoDesktop("1.0")}} | 2.0 | 7.2 | 1.2 |
truespeed attribute |
{{CompatNo}} | {{CompatGeckoDesktop("1.9")}} | 4.0 | {{CompatNo}} | {{CompatNo}} |
hspace/vspace attribute |
{{CompatUnknown}} | {{CompatGeckoDesktop("1.9")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
loop attribute |
{{CompatUnknown}} | {{CompatGeckoDesktop("1.9")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
truespeed attribute |
{{CompatUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
hspace/vspace attribute |
{{CompatUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |
loop attribute |
{{CompatUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatUnknown}} |