---
title: <marquee>:捲動元素(已過時)
slug: Web/HTML/Element/marquee
translation_of: Web/HTML/Element/marquee
---
<p>HTML <code>&lt;marquee&gt;</code> 元素用作插入一段文字的捲動區域。你可以透過屬性,控制文字在到達邊緣後的應對動作。</p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row">DOM 介面</th>
   <td>{{DOMxRef("HTMLMarqueeElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="屬性">屬性</h2>

<dl>
 <dt>{{htmlattrdef("behavior")}}</dt>
 <dd>設定文字如何在 marquee 內捲動。可用值為 <code>scroll</code>、<code>slide</code>、<code>alternate</code>。若無指定,預設值為 <code>scroll</code>。</dd>
 <dt>{{htmlattrdef("bgcolor")}}</dt>
 <dd>透過色彩名或十六進位值指定背景顏色。</dd>
 <dt>{{htmlattrdef("direction")}}</dt>
 <dd>設定 marquee 內的捲動方向。可用值為 <code>left</code>、<code>right</code>、<code>up</code>、<code>down</code>。若無指定,預設值為 <code>left</code>。</dd>
 <dt>{{htmlattrdef("height")}}</dt>
 <dd>設定像素或百分比高度。</dd>
 <dt>{{htmlattrdef("hspace")}}</dt>
 <dd>設定橫向外邊(horizontal margin)</dd>
 <dt>{{htmlattrdef("loop")}}</dt>
 <dd>設定 marquee 捲動的次數。若無指定,預設值為 -1,意思是的 marquee 將持續捲動。</dd>
 <dt>{{htmlattrdef("scrollamount")}}</dt>
 <dd>以像素為單位,設定捲動的間隔量。預設值為 6。</dd>
 <dt>{{htmlattrdef("scrolldelay")}}</dt>
 <dd>設定每次捲動時之間間隔的毫秒。預設值為 85。請注意,除非指定了 <code>truespeed</code>,否則小於 60 的數字會被忽略,並值使用 60。</dd>
 <dt>{{htmlattrdef("truespeed")}}</dt>
 <dd><code>scrolldelay</code> 預設上會忽略低於 60 的值。但如果有 <code>truespeed</code> 的話,就不會忽略此值。</dd>
 <dt>{{htmlattrdef("vspace")}}</dt>
 <dd>以像素或百分比值設置垂直邊距。</dd>
 <dt>{{htmlattrdef("width")}}</dt>
 <dd>設置以像素或百分比值為單位的寬度。</dd>
</dl>

<h2 id="Event_handlers" name="Event_handlers">事件處理器</h2>

<dl>
 <dt>{{htmlattrdef("onbounce")}}</dt>
 <dd>marquee 滾動到結尾時觸發。只能在 behavior 屬性設置為 <code>alternate</code> 時觸發。</dd>
 <dt>{{htmlattrdef("onfinish")}}</dt>
 <dd>marquee 完成 loop 屬性的設定值時觸發。只能在 loop 屬性設為大於 0 的數字時觸發。</dd>
 <dt>{{htmlattrdef("onstart")}}</dt>
 <dd>marquee 開始捲動時觸發。</dd>
</dl>

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

<dl>
 <dt>start()</dt>
 <dd>開始 marquee 的捲動</dd>
 <dt>stop()</dt>
 <dd>停止 marquee 的捲動</dd>
</dl>

<h2 id="示例">示例</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="規範">規範</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">規範</th>
   <th scope="col">狀態</th>
   <th scope="col">註解</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>為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。不過 CSS 的 marquee 功能<a href="https://www.w3.org/TR/css3-marquee/">已經停止開發</a>。</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'obsolete.html#the-marquee-element-0', '&lt;marquee&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>為了利於 CSS 而令其過時,但為了向下相容,還是定義了預期行為。不過 CSS 的 marquee 功能<a href="https://www.w3.org/TR/css3-marquee/">已經停止開發</a>。</td>
  </tr>
 </tbody>
</table>

<h2 id="瀏覽器相容性">瀏覽器相容性</h2>



<p>{{Compat("html.elements.marquee")}}</p>

<h2 id="參見">參見</h2>

<ul>
 <li>{{DOMxRef("HTMLMarqueeElement")}}</li>
</ul>