HTML Marquee

The <marquee> tag in HTML is used to create scrolling or moving text or images on a web page. The text or images move across the screen either horizontally or vertically, depending on how the tag is used.

Here's an example of a basic horizontal marquee:

<marquee behavior="scroll" direction="left">This text will scroll from right to left</marquee>
This text will scroll from right to left

In this example, the behavior attribute is set to "scroll", which means the text will continuously scroll across the screen. The direction attribute is set to "left", which means the text will move from right to left.

You can also set the speed of the marquee by using the scrollamount attribute, like this:

<marquee behavior="scroll" direction="left" scrollamount="10">This text will scroll from right to left at a speed of 10 pixels per second</marquee>
This text will scroll from right to left at a speed of 2 pixels per second

In this example, the scrollamount attribute is set to "10", which means the text will move at a speed of 10 pixels per second.

While the <marquee> tag can be useful for certain applications, it is generally not recommended to use it in modern web development due to accessibility and usability concerns. Instead, other techniques like CSS animations or JavaScript can be used to create similar effects.

Marquee Attribute

The <marquee> tag in HTML has several attributes that can be used to control the behavior of the marquee. Here's an overview of the most commonly used attributes:

  1. behavior: This attribute specifies the scrolling behavior of the marquee. It can be set to "scroll" for continuous scrolling, "slide" for the text to move in and out of view, or "alternate" to have the text scroll back and forth. For example:
  2. direction: This attribute specifies the direction in which the marquee will scroll. It can be set to "up", "down", "left", or "right". For example:
  3. scrollamount: This attribute specifies the speed of the marquee scrolling. It can be set to any positive integer value. For example:
  4. scrolldelay: This attribute specifies the delay between each scroll movement. It can be set to any positive integer value. For example:
  5. width and height: These attributes specify the dimensions of the marquee container. They can be set to any positive integer value or percentage value. For example:

These are some of the most commonly used attributes of the <marquee> tag in HTML. It's worth noting that the use of the <marquee> tag is generally discouraged in modern web development due to accessibility and usability concerns.

Next Article ❯