marquee存在两个的时候如何消除自带边距

来源:互联网 发布:淘宝卖家售假 编辑:程序博客网 时间:2024/06/07 06:40
html属性 <marquee></marquee>可以实现多种滚动效果,无需js控制.使用marquee标记不仅可以移动文字,也可以移动图片,表格等.
语法:<marquee>...</marquee>; 说明:在标记之间添加要进行滚动的内容.
标签属性:
1、ailgn
设定marquee标签的对齐方式
absbottom   绝对底部对齐
absmiddle   绝对中间对齐
baseline      基线对齐
bottom        底部对齐(默认)
left:左对齐
middle:中间对齐
right:右对齐
texttop:顶线对齐
top:顶部对齐
2、behavior设定滚动的方式:
alternate: 表示在两端之间来回滚动.
scroll: 表示由一端滚动到另一端,会重复.
slide:  表示由一端滚动到另一端,不会重复.
3、bgcolor
设定活动字幕的背景颜色,背景颜色可用RGB、16进制值的格式或颜色名称来设定.
代码如下:
<marquee bgcolor="#006699">设定活动字幕的背景颜色 bgcolor="#006699"</marquee>
<marquee bgcolor="RGB(10%,50%,100%,)">设定活动字幕的背景颜色 bgcolor="rgb(10%,50%,100%,)"</marquee>
<marquee bgcolor="red">设定活动字幕的背景颜色bgcolor="red"</marquee>
4、direction
设定活动字幕的滚动方向
代码如下:
<marquee direction="down">设定活动字幕的滚动方向direction="down":向下</marquee>
<marquee direction="left">设定活动字幕的滚动方向direction="left":向左</marquee>
<marquee direction="right">设定活动字幕的滚动方向direction="right":向右</marquee>
<marquee direction="up">设定活动字幕的滚动方向direction="up":向上</marquee>
5、height
设定活动字幕的高度
代码如下:
<marquee height="500" direction="down"bgcolor="#CCCCCC">设定活动字幕的高度height="500"</marquee>
6、width
设定活动字幕的宽度
代码如下:
<marquee width="500" bgcolor="#CCCCCC">设定活动字幕的宽度width="500"</marquee>
7、hspace
设定活动字幕里所在的位置距离父容器水平边框的距离代码如下:
  <table width="500"border="1" align="center" cellpadding="0"cellspacing="0">
    <tr>
      <td><marquee hspace="100"bgcolor="#CCCCCC">hspace="100"</marquee></td>
    </tr>
  </table>
8、vspace
设定活动字幕里所在的位置距离父容器垂直边框的距离代码如下:
<marquee vspace="100"bgcolor="#CCCCCC">hspace="100"</marquee>
9、loop
设定滚动的次数,当loop=-1表示一直滚动下去,默认为-1代码如下:
<marquee loop="-1"bgcolor="#CCCCCC">我会不停地走.</marquee>
<p>&nbsp;</p>
<marquee loop="2" bgcolor="#CCCCCC">我只走两次哦</marquee> 10、scrollamount
设定活动字幕的滚动速度,单位pixels
代码如下:
<marquee scrollamount="10">scrollamount="10" </marquee>
<marquee scrollamount="20" >scrollamount="20"</marquee>
<marquee scrollamount="30" >scrollamount="30"</marquee>
11、scrolldelay
设定活动字幕滚动两次之间的延迟时间,单位millisecond(毫秒)值大了会有一步一停顿的效果代码如下:
<marquee scrolldelay="10">scrolldelay="10" </marquee>
<marquee scrolldelay="100" >scrolldelay="100"</marquee>
<marquee scrolldelay="1000">scrolldelay="1000"</marquee>
其次,如果此时边距影响,给其父元素设置line-height,即可解决两个marquee之间的边距问题Marquee 也可以做飘浮广告效果: 
<marquee behavior="alternate"height="300" direction="up" scrollamount="3"scrolldelay="30" width="300" bgcolor="#3399FF"> <marquee behavior="alternate"height="50" direction="left" scrollamount="3"scrolldelay="30" width="100%"> <font style="font-size: 35px">Ouyang</font> 
</marquee>
<marquee> ... </marquee> 
移动属性的设置 ,这种移动不仅仅局限于文字,也可以应用于图片,表格等等