In HTML, a marquee is an element used to create scrolling text or images horizontally or vertically across a web page. It was commonly used in the early days of the web to add animated elements to a webpage. The <marquee> tag has the following syntax:
<marquee direction="direction" behavior="behavior" scrollamount="scrollamount">
Content to scroll
</marquee>
Here's what each attribute does:
-
direction:
Specifies the direction in which the content scrolls. It can be set to"left", "right", "up", or "down"
. -
behavior
: Specifies the behavior of the scrolling content. It can be set to"scroll"
, which continuously scrolls the content, or"alternate"
, which scrolls the content back and forth. -
scrollamount
: Specifies the speed of the scrolling content. Higher values make the content scroll faster.
For example, to create a marquee that scrolls text from right to left at a speed of 2 pixels per frame, you could use the following code:
<marquee direction="left" behavior="scroll" scrollamount="2">
This text will scroll from right to left.
</marquee>
It's important to note that the <marquee> tag is considered obsolete in HTML5 and may not be supported by all browsers. It's generally recommended to use CSS animations or JavaScript for similar effects instead