marquee元素如何实现滚动字体与图片的效果


本文摘自PHP中文网,作者php中世界最好的语言,侵删。

这次给大家带来marquee元素如何实现滚动字体与图片的效果,marquee元素实现滚动字体与图片的效果的注意事项有哪些,下面就是实战案例,一起来看一下。

marquee元素可以实现简单的字体(图片等)的滑动等效果:

1

2

3

4

5

6

7

8

9

10

11

<style type="text/css">

#div01{

width: 500px;

}

</style>

<script type="text/javascript">

</script>

<marquee behavior="alertnate"><font size=30 color='red'>www.baidu.com111</font></marquee>

<marquee direction=right bgcolor='#ff2233' behavior="alertnate"><font size=30 color='blue'>www.baidu.com222</font></marquee>

<marquee id="m3" direction=down bgcolor='#dbdbdb' height=50px hspace=20px vspace=20px behavior="alertnate" scrollLeft=left onmouseover="this.stop()" onmouseout="this.start()"><font size=30 color='blue'>www.baidu333.com</font></marquee>

<marquee id="m4" direction=up bgcolor='#00dbdb' behavior="alertnate"><font size=30 color='blue'>www.baidu444.com</font></marquee>

1

2

3

4

5

<div id="div01"><marquee direction=right bgcolor='#ff2233' behavior="alertnate" scrolldelay=100><font size=30 color='blue'>www.baidu.com555</font></marquee></div>

<input type="button" onclick="m3.stop();" value="m3.stop"></input>

<input type="button" onclick="m3.start();" value="m3.start"></input>

<button onclick="m4.stop();">m4.stop</button>

<button onclick="m4.start();">m4.start</button>

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 表示元素到区域边界的水平距离和垂直距离,值是正整数,单位是像素。
onmouseover=this.stop() onmouseout=this.start() 表示当鼠标以上区域的时候滚动停止,当鼠标移开的时候又继续滚动。
以下是设置点击按钮时m3、m4的滚动或停止:

1

2

3

4

<input type="button" onclick="m3.stop();" value="m3.stop"></input>

<input type="button" onclick="m3.start();" value="m3.start"></input>

<button onclick="m4.stop();">m4.stop</button>

<button onclick="m4.start();">m4.start</button>

相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

Div怎样设置边框和透明度样式

HTML的meta viewport属性应该如何使用

怎样操作a标签的默认样式

如何在页面中调用搜索引擎

怎么修改form的默认提交方式

以上就是marquee元素如何实现滚动字体与图片的效果的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

html怎样对图片实现checkbox方法

jquery+jsonp跨域需要怎样实现

vue.js-div怎么隐藏滚动条

如何通过display或visibility来实现html元素的显示与隐藏

配置h5的滚动条样式

前端页面跳转并取值的实现

html如何实现文字的滚动效果

html怎样借助marquee实现文字左右滚动

html中滚动条的代码是什么?如何设置html滚动条?

使用html5中的localstorage实现记住密码功能

更多相关阅读请进入《marquee》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...