This HTML tutorial explains how to use the HTML marquee tag with syntax and examples. The HTML
<marquee> tag is used to scroll an image or text horizontally or vertically used on webpages, website or blogs. In simple words, it scrolls the image or text up, down, left or right automatically.
By default, text within the <marquee> tag will scroll from right to left. The marquee tag has been deprecated in HTML5 and should no longer be used. You should use CSS instead to create a similar scrolling effect. We can now use the following CSS3 properties like marquee-play-count, marquee-style, overflow-style, marquee-direction and marquee-speed.
You can also easily control marquee speed, marquee scrolldelay, marquee direction and Stop or start marquee on mouseover and mouseout using marquee attributes.
The 'Direction' Attribute is used to change the direction of scrolling text inside the marquee tag. The direction of text or image data inside marquee tag can be left, right, up and down.
|behavior||The behavior of how the text scrolls... It sets the behavior of the marquee to one of the three different types: scroll, slide, and alternate.|
|bgcolor||Change background color.|
|direction||It defines the direction for scrolling content, like left/right/up/down.|
|height||It defines the height of the marquee in pixels or '%'.|
|width||It defines the width of marquee in pixels or '%'.|
|hspace||It defines horizontal space in pixels around the marquee.|
|vspace||It defines vertical space in pixels around the marquee.|
|scrolldelay||The delay in milliseconds between scrolling. The default value is 85 if the scrolldelay is not specified. If a value lower than 60 is provided, the truespeed attribute must also be used|
|scrollamount||The amount of scrolling (in pixels) for each interval. The default value is 6 if the scrollamount is not specified.|
|truespeed||Use this attribute to indicate that a scrolldelay value of 60 is allowed. Otherwise, the scrolldelay value will be rounded up to 60.|
|loop||It defines the number of times that the text will scroll. The default value is -1 which means that the marquee will loop continuously.|
|bgcolor||It defines background color. It is now depreciated.|
The marquee tag has the following methods:
|start()||It starts the text scrolling within the marquee.|
|stop()||It stops the text from scrolling within the marquee.|
The <marquee> tag has the following event handlers:
|onbounce||The onbounce event fires when the behavior attribute is set to alternate and the text has reached the edge of the marquee.|
|onfinish||The onfinish event fires when the loop attribute is set to a value higher than 0 and the marquee has finished looping the specified number of times.|
|onstart||This event fires when the text starts to scroll.|