<marquee> 是早期網頁常見的滾動文字標籤,雖非 W3C 標準,但瀏覽器相容性極佳。Dreamweaver 雖無視覺化介面,透過代碼視圖即可靈活控制。
<marquee scrollAmount="2" width="300">滾動字幕內容</marquee>
| 屬性 | 說明 | 建議值 |
|---|---|---|
| scrollAmount | 移動速度(像素/幀),值越大越快 | 1~3(預設 6) |
| width / height | 滾動區域寬高,垂直滾動必須設 height | 依版面而定 |
| direction | 滾動方向:left(預設)、right、up、down | 視設計需求 |
| scrollDelay | 幀延遲(毫秒),值越大越慢 | 通常不需設定(預設 90) |
| behavior | 滾動模式:scroll(循環)、alternate(來回)、slide(滑入停止) | scroll |
<marquee scrollAmount="2" width="300"><a href="https://example.com">連結文字</a></marquee>
<marquee scrollAmount="2" width="300" onmouseover="this.stop()" onmouseout="this.start()">內容</marquee>
<marquee scrollAmount="2" width="200" behavior="alternate">文字內容</marquee>
<marquee scrollAmount="2" width="300" height="160" direction="up">
·第一行訊息<br>
·第二行訊息<br>
·<a href="...">更多</a>
</marquee>
若經 FrontPage 編輯後導致只能滾動單行,將完整 marquee 代碼包裹在 document.write() 中輸出即可解決:
<script>document.write('<marquee ...>內容</marquee>')</script>
建議:現代網頁建議改用 CSS Animation 或 JavaScript 實現更標準、可控的滾動效果。