HTML標籤marquee實現滾動效果
阿新 • • 發佈:2018-12-26
頁面的自動滾動效果,可由javascript來實現,但是今天無意中發現了一個html標籤 - 可以實現多種滾動效果,無需js控制。
使用marquee標記不僅可以移動文字,也可以移動圖片,表格等.
語法:<marquee>...</marquee>
; 說明:在標記之間新增要進行滾動的內容。
重要屬性
滾動方向direction (包括四個值 up,down,left和right)
語法:
<marquee direction="滾動方向">....</marquee>
滾動的方式behavior( scroll:迴圈滾動 預設效果 slide : 滾動一次就停止 , alternate:來回交替滾動 )
語法:
<marquee behavior="滾動方式">....</marquee>
滾動速度scrollamount( 設定滾動每次移動時的時長 , 單位是畫素 )
語法:
<marquee scrollamount="5">....</marquee>
滾動延遲scrolldelay( 設定滾動的時間間隔 , 單位是毫秒 )
語法:
<marquee scrolldelay="100">....</marquee>
迴圈滾動oop( 預設值為-1 , 滾動會不斷迴圈下去 )
語法:
<marquee loop="2">....</marquee>
滾動範圍width height
語法:
<marquee width='1000' height='200'>....</marquee>
滾動背景顏色bgcolor
語法:
<marquee bgcolor="#0099FF">....</marquee>
空白空間hspace(垂直). vspace(水平)
語法:
<marquee hspace="10" vspace="10">....</marquee>
程式碼演示
<marquee direction="up" behavior="scroll" scrollamount="1" scrolldelay="0" loop="-1" width="1000"height="50" bgcolor="#0099FF" hspace="10" vspace="10">
動起來marquee和我一起搖擺
</marquee>