marquee标签详解

marquee标签详解
html标签 - <marquee></marquee>可以实现多种滚动效果,⽆需js控制。使⽤marquee标记不仅可以移动⽂字,也可以移动图⽚,表格等.只需要在<marquee></marquee>内部输⼊要滚动的内容即可。
主要属性:(都是可选的)
behavior              (控制滚动)
bgcolor                (⽂字滚动范围的背景颜⾊)
direction              (⽂字滚动的⽅向)
width                    (决定滚动⽂字在页⾯中的矩形范围的宽度)
height                  (决定滚动⽂字在页⾯中的矩形范围的⾼度)
hspace                (滚动矩形区域距周围的空⽩区域)
vspace                  (滚动矩形区域距周围的空⽩区域)
loop                      ( 滚动⽂字的滚动次数)
scrollamount      (⽂字滚动的速度)
scrolldelay          (⽂字滚动的速度)
align                    (滚动⽂字位于距形内边框的上下左右位置)
参数 :
direction 表⽰滚动的⽅向,值可以是left,right,up,down,默认为left
behavior 表⽰滚动的⽅式,值可以是scroll(连续滚动)slide(滑动⼀次)alternate(来回滚动)
loop 表⽰循环的次数,值是正整数,默认为⽆限循环
scrollamount 表⽰运动速度,值是正整数,默认为6
scrolldelay 表⽰停顿时间,值是正整数,默认为0,单位是毫秒
align 表⽰元素的垂直对齐⽅式,值可以是top,middle,bottom,默认为middle
增大药剂bgcolor 表⽰运动区域的背景⾊,值是16进制的RGB颜⾊,默认为⽩⾊
height、width 表⽰运动区域的⾼度和宽度,值是正整数(单位是像素)或百分数,默认width=100% height为标签内元素的⾼度。
hspace、vspace 表⽰元素到区域边界的⽔平距离和垂直距离,值是正整数,单位是像素。
οnmοuseοver=this.stop() οnmοuseοut=this.start() 表⽰当⿏标以上区域的时候滚动停⽌,当⿏标移开的时候⼜继续滚动。
⼀、属性
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>
direction属性 :
⽂字滚动的⽅向,属性的参数值有down、left、right、up共四个单⼀可选值,分别代表滚动⽅向向下、向左、向右、向上。如下所⽰:
<marquee direction="right">我向右滚动</marquee>
<marquee direction="down">我向下滚动</marquee>
width和height属性 :
width和height属性的作⽤决定滚动⽂字在页⾯中的矩形范围⼤⼩。width属性⽤以规定矩形的宽度,height属性规定矩形的⾼度。这两个属性的参数值可以是数字或者百分数,数字表⽰矩形所占的(宽或⾼)像素点数,百分数表⽰矩形所占浏览器窗⼝的(宽或⾼)百分⽐。如下所⽰:
<marquee width="300" height="30" bgcolor="red">我宽300像素,⾼30像素。</marquee>
hspace和vspace属性 :
这两个属性决定滚动矩形区域距周围的空⽩区域.
<marquee width="300" height="30" vspace="10" hspace="10" bgcolor="red">我矩形边缘⽔平和垂直距周围各10像素。</marquee>
<marquee width="300" height="30" vspace="50" hspace="50" bgcolor="red">我矩形边缘⽔平和垂直距周围各50像素。</marquee>
loop属性 :
loop属性决定滚动⽂字的滚动次数,缺省是⽆限循环。参数值可以是任意的正整数,如果设置参数值为-1或infinite时将⽆限循环。如下所⽰:
<marquee loop="2">我滚动2次。</marquee>
<marquee loop="infinite">我⽆限循环滚动。</marquee>
假牙加工<marquee loop="-1">我⽆限循环滚动。</marquee>
scrollamount和scrolldelay属性 :
这两个属性决定⽂字滚动的速度(scrollamount)和延时(scrolldelay),参数值都是正整数。如下所⽰:
<marquee scrollamount="100">我速度很快.</marquee>
<marquee scrollamount="50">我慢了些。</marquee>
<marquee scrolldelay="30">我⼩步前进。</marquee>
<marquee scrolldelay="1000" scrollamount="100">我⼤步前进。</marquee>显示器电路板
align属性 :
这个属性决定滚动⽂字位于距形内边框的上下左右位置。您也可以将<marquee>和</marquee>之间的内容替换为图像或其它对象等功能。
注释  :
⽰例
下⾯的例⼦使⽤了 marquee 元素创建了由左向右的滚动字幕,移动速度为每 200 毫秒 10 像素。
<marquee direction="right" behavior="scroll" scrollamount=10 scrolldelay=200>这是⼀个滚动字幕。</marquee>
演⽰多⾏⽂本向上滚动
<marquee scrollAmount=2 width=300 height=160 direction=up>·早晨好啊!<br>·空⽓好清新啊<br>·今朝⾷乜好呢?<p>·<a href=v>中央电视台</ 下⾯的例⼦显⽰了 marquee 元素的 scrollLeft 和 scrollTop 属性的⼀些⽤途。
<marquee id=m1 direction="right" width=200 height=200>向右</marquee>
<!-- 单击此按钮可在字幕滚动时读取 scrollLeft 和 scrollTop 属性的值。 -->
<button onclick="alert('scrollLeft: ' + m1.scrollLeft + ' scrollRight: ' + m1.scrollTop)">读取</button><br>
<!-- 当字幕停⽌时,你可以设置⽔平字幕的 scrollLeft,或者设置垂直字幕的 scrollTop。 -->
<button onclick="m1.stop();m1.scrollLeft = 190;">停⽌并设置 scrollLeft=190</button><br>
<button onclick="m1.start();">开始</button><br>
所有代码:
<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>
<hr>
<marquee behavior="slide" direction="left" bgcolor="red">我的背景⾊是红⾊的</marquee>
<hr>
<marquee direction="right">我向右滚动</marquee>
<marquee direction="down">我向下滚动</marquee>
<hr>
<marquee width="300" height="30" bgcolor="red">我宽300像素,⾼30像素。</marquee>
<hr>
<marquee width="300" height="30" vspace="10" hspace="10" bgcolor="red">我矩形边缘⽔平和垂直距周围各10像素。</marquee> <marquee width="300" height="30" vspace="50" hspace="50" bgcolor="red">我矩形边缘⽔平和垂直距周围各50像素。</marquee> <hr>
大豆糖蜜
<marquee loop="2">我滚动2次。</marquee>
<marquee loop="infinite">我⽆限循环滚动。</marquee>
螺杆并联压缩机组<marquee loop="-1">我⽆限循环滚动。</marquee>
<hr>
<marquee scrollamount="100">我速度很快.</marquee>
<marquee scrollamount="50">我慢了些。</marquee>
<marquee scrolldelay="30">我⼩步前进。</marquee>
<marquee scrolldelay="1000" scrollamount="100">我⼤步前进。</marquee>
<hr>
<marquee direction="right" behavior="scroll" scrollamount=10 scrolldelay=200>这是⼀个滚动字幕。</marquee>
<hr>
<marquee id=m1 direction="right" width=200 height=200>向右</marquee>
<!-- 单击此按钮可在字幕滚动时读取 scrollLeft 和 scrollTop 属性的值。 -->
<button onclick="alert('scrollLeft: ' + m1.scrollLeft + ' scrollRight: ' + m1.scrollTop)">读取</button><br>
<!-- 当字幕停⽌时,你可以设置⽔平字幕的 scrollLeft,或者设置垂直字幕的 scrollTop。 -->
<button onclick="m1.stop();m1.scrollLeft = 190;">停⽌并设置 scrollLeft=190</button><br>
<button onclick="m1.start();">开始</button><br>
⼆、事件
手动皂液器
实例:
1、⿏标停留在⽂字上,⽂字停⽌滚动
<marquee scrollAmount=2 width=300 onmouseover=stop() onmouseout=start()>⽂字内容</marquee>

本文发布于:2024-09-23 05:32:14,感谢您对本站的认可!

本文链接:https://www.17tex.com/tex/3/287075.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:滚动   矩形   区域
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议