HTML选框是根据设置在网页上横向或垂直向下显示的滚动文本.这是通过使用HTML< marquees>创建的.标签.
注意 : < marquee> HTML5中不推荐使用标记.不要使用这个元素,而是可以使用JavaScript和CSS来创建这样的效果.
语法
一个简单的语法HTML< marquee>标签如下 :
<marquee attribute_name = "attribute_value"....more attributes> One or more lines or text message or image </marquee>
< marquee>标签属性
以下是可与< marquee>一起使用的重要属性列表标签.
Sr.No | 属性&描述 |
---|---|
1 |
宽度 这指定了选框的宽度.这可以是10或20%等值. |
2 |
身高 这指定了选框的高度.这可以是10或20%等值. |
3 |
方向 这指定了选框应滚动的方向.这可以是 up,down,left 或 right 之类的值. |
4 |
行为 这指定了选框的滚动类型.这可以有一个值,如滚动,滑动和替代. |
5 |
scrolldelay 这指定每次跳转之间的延迟时间.这将具有类似10等的值. |
6 |
scrollamount 这指定了选框文字的速度.这个值可以是10等. |
7 |
循环 这指定循环次数.默认值为INFINITE,这意味着选取框无休止地循环. |
8 |
bgcolor 根据颜色名称指定背景颜色或颜色十六进制值. |
9 |
hspace 这指定了选框周围的水平空间.这可以是10或20%等值. |
10 |
vspace 这指定了选框周围的垂直空间.这可以是10或20%等值. |
以下是几个用于演示marquee标签用法的示例.
示例 - 1
<!DOCTYPE html> <html> <head> <title>HTML marquee Tag</title> </head> <body> <marquee>This is basic example of marquee</marquee> </body> </html>
示例- 2
<!DOCTYPE html> <html> <head> <title>HTML marquee Tag</title> </head> <body> <marquee width = "50%">This example will take only 50% width</marquee> </body> </html>
示例- 3
<!DOCTYPE html> <html> <head> <title>HTML marquee Tag</title> </head> <body> <marquee direction = "right">This text will scroll from left to right</marquee> </body> </html>
示例- 4
<!DOCTYPE html> <html> <head> <title>HTML marquee Tag</title> </head> <body> <marquee direction = "up">This text will scroll from bottom to up</marquee> </body> </html>