section标签实现文字滚动

h5新增样式

section标签 使用demo
//h5新增属性

h5新增滚动的标签 <marquee>
<div style="padding-left: 20px;margin-top: 10px;color: #fff;">
<marquee behavior="scroll" bgcolor='red' direction="left" width='100%' height='30'>单方向循置参数的设置haha参数的设置参数的设置</marquee>
</div>

  section标签的使用属性,与案例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>MARQUEE 的使用</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
		body{
			font-size: 14px;
		}
	</style>
</head>
<body>
	
	<!-- 说明:<marquee>标签,它是成对出现的标签,首标签<marquee>和尾标签</marquee>之间的内容就是滚动内容。<marquee>标签的属性主要有behavior、bgcolor、direction、width、height、hspace、vspace、loop、scrollamount、scrolldelay等,它们都是可选的。

		每个属性对应的属性值:
		behavior属性
	behavior属性的参数值为alternate、scroll、slide中的一个,分别表示文字来回滚动、单方向循环滚动、只滚动一次,需要注意的是:如果在<marquee>标签中同时出现了direction和behavior属性,那么scroll和slide的滚动方向将依照direction属性中参数的设置。
		bgcolor属性
文字滚动范围的背景颜色,参数值是16进制(形式:#AABBCC或#AA5566等)或预定义的颜色名字(如red、yellow、blue等)。如下所示:<marquee behavior=="slide" direction="left" bgcolor="red">我的背景色是红色的</marquee> 
	direction属性 
文字滚动的方向,属性的参数值有down、left、right、up共四个单一可选值,分别代表滚动方向向下、向左、向右、向上。
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>之间的内容替换为图像或其它对象等功能

onmouseover=this.stop() onmouseout=this.start() 表示当鼠标以上区域的时候滚动停止,当鼠标移开的时候又继续滚动。

	 -->
	<marquee behavior="alternate">来回滚动参数的设置参数的设置</marquee>
	<div style="padding-left: 20px;margin-top: 10px;color: #fff;">
		<marquee behavior="scroll" bgcolor='red' direction="left" width='100%' height='30'>单方向循置参数的设置haha参数的设置参数的设置</marquee>
	</div>
	<div style="padding-left: 30px;margin-top: 10px;">
		<marquee behavior="slid">只滚动一次的设置haha参数的设置参数的设置</marquee>
	</div>
</body>
<script src="../../js/jquery_v3.3.1.js"></script>
<script>
	
</script>
</html>

  

原文地址:https://www.cnblogs.com/lvxisha/p/10651651.html