Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1124025 of <marquee>

  • Revision slug: Web/HTML/Element/marquee
  • Revision title: <marquee>
  • Revision id: 1124025
  • Created:
  • Creator: zd9027
  • Is current revision? No
  • Comment

Revision Content

{{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 and alternate.
可用值为 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 and down.

可用值为左右上下。

If no value is specified, the default value is left.

 如果没有特别指定,默认值是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. If truespeed 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}}

Revision Source

<div>{{HTMLRef}}</div>

<div>{{obsolete_header}}</div>

<h2 id="Summary" name="Summary">Summary概述</h2>

<p>The HTML <code>&lt;marquee&gt;</code> element is used to insert a scrolling area of text.</p>

<p>html的<code>marquee元素用于插入滚动文本。</code></p>

<h2 id="Attributes">Attributes属性</h2>

<dl>
 <dt>{{htmlattrdef("behavior滚动方式")}}</dt>
 <dd>Sets how the text is scrolled within the marquee.</dd>
 <dd>设置文本在marquee中如何滚动。</dd>
 <dd>Possible values are <code>scroll</code>, <code>slide</code> and <code>alternate</code>.</dd>
 <dd>可用值为&nbsp;<code>scroll</code>循环滚动, <code>slide</code>只滚动一次就停止&nbsp;和&nbsp;<code>alternate</code>来回交替进行滚动。</dd>
 <dd>If no value is specified, the default value is <code>scroll</code>.</dd>
</dl>

<p>&nbsp; &nbsp; &nbsp;如果没有特别指定,默认值是<code>scroll</code>循环滚动。</p>

<dl>
 <dt>{{htmlattrdef("bgcolor背景色")}}</dt>
 <dd>Sets the background color through color name or hexadecimal value.</dd>
</dl>

<p>&nbsp; &nbsp; &nbsp;通过颜色名或十六进制值来设置背景色。</p>

<dl>
 <dt>{{htmlattrdef("direction滚动方向")}}</dt>
 <dd>Sets the direction of the scrolling within the marquee.</dd>
</dl>

<p>设置marquee内的滚动方向</p>

<dl>
 <dd>Possible values are <code>left</code>, <code>right</code>, <code>up</code> and <code>down</code>.</dd>
</dl>

<p>可用值为左右上下。</p>

<dl>
 <dd>If no value is specified, the default value is <code>left</code>.</dd>
</dl>

<p>&nbsp;如果没有特别指定,默认值是<code>left</code>。</p>

<dl>
 <dt>{{htmlattrdef("height高度(滚动范围)")}}</dt>
 <dd>Sets the height in pixels or percentage value.</dd>
</dl>

<p>使用像素或百分比设置高度。</p>

<dl>
 <dt>{{htmlattrdef("hspace")}}</dt>
 <dd>Sets the horizontal margin</dd>
</dl>

<p>设置水平外边距</p>

<dl>
 <dt>{{htmlattrdef("loop")}}</dt>
 <dd>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.</dd>
 <dt>{{htmlattrdef("scrollamount滚动速度")}}</dt>
 <dd>Sets the amount of scrolling at each interval in pixels. The default value is 6.</dd>
 <dt>{{htmlattrdef("scrolldelay滚动延迟")}}</dt>
 <dd>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<code> truespeed </code>is specified.</dd>
 <dt>{{htmlattrdef("truespeed")}}</dt>
 <dd>By default,<code> scrolldelay </code>values lower than 60 are ignored. If<code> truespeed </code>is present, those values are not ignored.</dd>
 <dt>{{htmlattrdef("vspace")}}</dt>
 <dd>Sets the vertical margin in pixels or percentage value.</dd>
</dl>

<p>使用像素或百分比设置水平外边距</p>

<dl>
 <dt>{{htmlattrdef("width宽度(滚动范围)")}}</dt>
 <dd>Sets the width in pixels or percentage value.</dd>
</dl>

<p>使用像素或百分比设置宽度。</p>

<h2 id="Event_handlers" name="Event_handlers">Event handlers</h2>

<dl>
 <dt>{{htmlattrdef("onbounce")}}</dt>
 <dd>Fires when the marquee has reached the end of its scroll position. It can only fire when the behavior attribute is set to <code>alternate</code>.</dd>
 <dt>{{htmlattrdef("onfinish")}}</dt>
 <dd>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.</dd>
 <dt>{{htmlattrdef("onstart")}}</dt>
 <dd>Fires when the marquee starts scrolling.</dd>
</dl>

<h2 id="Methods" name="Methods">Methods</h2>

<dl>
 <dt>start</dt>
 <dd>Starts scrolling of the marquee.</dd>
 <dt>stop</dt>
 <dd>Stops scrolling of the marquee.</dd>
</dl>

<h2 id="Examples">Examples</h2>

<pre class="brush: html">
&lt;marquee&gt;This text will scroll from right to left&lt;/marquee&gt;

&lt;marquee direction="up"&gt;This text will scroll from bottom to top&lt;/marquee&gt;

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

<p>{{EmbedLiveSample("Examples", 600, 450)}}</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'obsolete.html#the-marquee-element-2', '&lt;marquee&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility.</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'obsolete.html#the-marquee-element-0', '&lt;marquee&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>Make it obsolete in favor of CSS but define its expected behavior, for backward compatibility.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>1.0</td>
   <td>{{CompatGeckoDesktop("1.0")}}</td>
   <td>2.0</td>
   <td>7.2</td>
   <td>1.2</td>
  </tr>
  <tr>
   <td><code>truespeed</code> attribute</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoDesktop("1.9")}}</td>
   <td>4.0</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
  <tr>
   <td><code>hspace/vspace</code> attribute</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop("1.9")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>loop</code> attribute</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop("1.9")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("1.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>truespeed</code> attribute</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("1.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>hspace/vspace</code> attribute</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("1.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
  <tr>
   <td><code>loop</code> attribute</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatGeckoMobile("1.0")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>
Revert to this revision