A simple way to achieve scrolling effect with HTML tag marquee (must read)

A simple way to achieve scrolling effect with HTML tag marquee (must read)

The automatic scrolling effect of the page can be achieved by JavaScript, but today I accidentally discovered an HTML tag - <marquee></marquee> which can achieve a variety of scrolling effects without JS control.

The marquee tag can be used to move not only text, but also images, tables, etc.

Syntax: <marquee>...</marquee>; Description: Add the content to be scrolled between the tags.

Important properties:

1. Scroll direction (including 4 values: up, down, left and right)

Syntax: <marquee direction="scroll direction">...</marquee>

2. Scrolling behavior (scroll: scroll in a loop, the default effect; slide: scroll once and then stop; alternate: scroll back and forth alternately)

Syntax: <marquee behavior="scroll mode">...</marquee>

3. Scroll speed scrollamount (scroll speed is to set the length of movement each time you scroll, in pixels)

Syntax: <marquee scrollamount="5">...</marquee>

4. Scroll delay scrolldelay (set the scrolling time interval in milliseconds)

Syntax: <marquee scrolldelay="100">...</marquee>

5. Scroll loop (the default value is -1, the scroll will continue to loop)

Syntax: <marquee loop="2">...</marquee>

6. Scroll range width, height

7. Scrolling background color bgcolor

8. Blank space hspace, vspace

Code example:

XML/HTML CodeCopy content to clipboard
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >   
  2. < html   xmlns = "http://www.w3.org/1999/xhtml" >   
  3. < head >   
  4. < meta   http-equiv = "Content-Type"   content = "text/html; charset=utf-8"   />   
  5. < title > Untitled Document </ title >   
  6. </ head >   
  7.   
  8. < body >   
  9. < div >   
  10. < marquee   direction = "up"   behavior = "scroll"   scrollamount = "1"   scrolldelay = "0"   loop = "-1"   width = "1000"   height = "50"   bgcolor = "#0099FF"   hspace = "10"   vspace = "10" >   
  11. Refers to the alignment of the entire Marquee; (2) behavior: Set the scrolling method: scroll: means scrolling from one end to the other, it will repeat, but the disadvantage is that it cannot scroll seamlessly. Slide: means scrolling from one end to the other without repeating...
  12. </ marquee >   
  13. </ div >   
  14. </ body >   
  15. </ html >   

The above is all the content of the simple method (must read) of using HTML tag marquee to achieve scrolling effect. I hope you like it~

<<:  A brief discussion on the issue of element dragging and sorting in table

>>:  How to set remote access permissions in MySQL 8.0

Recommend

Solution to Chinese garbled characters when operating MySQL database in CMD

I searched on Baidu. . Some people say to use the...

How to modify the forgotten password when installing MySQL on Mac

1. Install MySQL database on mac 1. Download MySQ...

Three Ways to Find the Longest Word in a String in JavaScript (Recommended)

This article is based on the Free Code Camp Basic...

Design Association: Why did you look in the wrong place?

I took the bus to work a few days ago. Based on m...

Summary of commonly used time, date and conversion functions in Mysql

This article mainly summarizes some commonly used...

Six-step example code for JDBC connection (connecting to MySQL)

Six steps of JDBC: 1. Register the driver 2. Get ...

How to build a drag and drop plugin using vue custom directives

We all know the drag-and-drop feature of HTML5, w...

GDB debugging MySQL actual combat source code compilation and installation

Download source code git clone https://github.com...

Analysis of MySQL query sorting and query aggregation function usage

This article uses examples to illustrate the use ...

Use vue2+elementui for hover prompts

Vue2+elementui's hover prompts are divided in...

Examples of using the or statement in MySQL

1. The use of or syntax in MySQL, and the points ...

MySQL knowledge points for the second-level computer exam mysql alter command

Usage of alter command in mysql to edit table str...

Linux kernel device driver memory management notes

/********************** * Linux memory management...

Is the tag li a block-level element?

Why can it set the height, but unlike elements lik...

Vue: Detailed explanation of memory leaks

What is a memory leak? A memory leak means that a...