
首先讓我們認識這個html marquee標簽:
這個marquee標簽以前專門寫過關于它的一些用法和屬性,大家可以點擊html中滾動條的代碼是什么?如何設置html滾動條?看看。
marquee 標簽,它是成對出現的標簽,首標簽 marquee 和尾標簽 /marquee 之間的內容就是滾動內容。 marquee 標簽的屬性主要有behavior、bgcolor、direction、width、height、hspace、vspace、loop、scrollamount、scrolldelay等,它們都是可選的。
現在看看marquee標簽如何實現上下滾動的:
html marquee標簽的behavior屬性:
behavior屬性的參數值為alternate、scroll、slide中的一個,分別表示文字來回滾動、單方向循環滾動、只滾動一次,需要注意的是:如果在 marquee 標簽中同時出現了direction和behavior屬性,那么scroll和slide的滾動方向將依照direction屬性中參數的設置。
marquee behavior= alternate 我來回滾動 /marquee marquee behavior= scroll 我單方向循環滾動 /marquee marquee behavior= scroll direction= up height= 30 我改單方向向上循環滾動 /marquee marquee behavior= slide 我只滾動一次 /marquee marquee behavior= slide direction= up 我改向上只滾動一次了 /marquee
bgcolor屬性文字滾動范圍的背景顏色,參數值是16進制(形式:#AABBCC或#AA5566等)或預定義的顏色名字(如red、yellow、blue等)。如下所示: marquee behavior== slide direction= left bgcolor= red 我的背景色是紅色的 /marquee
還有html marquee標簽的direction屬性:
文字滾動的方向,屬性的參數值有down、left、right、up共四個單一可選值,分別代表滾動方向向下、向左、向右、向上。如下所示:
marquee direction= right 我向右滾動 /marquee marquee direction= left 我向左滾動 /marquee marquee direction= down 我向下滾動 /marquee marquee direction= up 我向上滾動 /marquee
主要是后面兩個,就是本文首要介紹的上下滾動,設置了這個就能讓里面的文本進行上下滾動效果。
現在說說看marquee標簽的滾動速度:
這個html marquee標簽的滾動速度是哪個屬性呢?有沒有人能猜到。。。
好吧,還是我自己說吧,是scrollamount和scrolldelay屬性:
這兩個屬性決定文字滾動的速度(scrollamount)和延時(scrolldelay),參數值都是正整數。如下所示:
marquee scrollamount= 100 我速度很快. /marquee marquee scrollamount= 50 我慢了些。 /marquee marquee scrolldelay= 30 我小步前進。 /marquee marquee scrolldelay= 1000 scrollamount= 100 我大步前進。 /marquee
可以設置具體的數字,你想多快就多快,你想多慢就多慢,是不是很有趣呢。但是因為都是動圖,都是不好截圖的,給大家推薦個可以直接復制就能出效果的網址:http://www.survivalescaperooms.com/code/26516.html,只要把上面的代碼復制進去就能顯示出效果了。大家可以試試看。
好了,本篇關于html marquee標簽的兩種用法都在這里了。有問題的可以在下方提問。
【小編推薦】
html中滾動條的代碼是什么?如何設置html滾動條?
html5 progress標簽怎么用?progress標簽的屬性介紹
以上就是html marquee標簽如何實現上下滾動,marquee標簽的滾動速度設置的詳細內容,html教程
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答