
<marquee>
Tag in HTML – Full Details with suitable example
- The
<marquee>
tag is an HTML element used to create scrolling text or images that move automatically across a webpage. - The
<marquee>
tag is used to move any text, image or any graphics in html. - It was introduced in older versions of HTML and is not part of the HTML5 standard (deprecated). However, many browsers still support it for backward compatibility.
Syntax (Marquee Tag in HTML)
Anything placed inside <marquee>
(text, images, links, etc.) will scroll automatically.
Attributes of <marquee>
Here are the commonly used attributes:
-
direction
-
Defines the scrolling direction.
-
Values:
left
(default),right
,up
,down
. -
Example:
-
-
behavior
-
Defines the type of scrolling.
-
Values:
-
scroll
→ Scrolls continuously (default). -
slide
→ Stops when it reaches the end. -
alternate
→ Bounces back and forth.
-
-
Example:
-
-
scrollamount
-
Sets the speed of scrolling (in pixels). Higher value = faster speed.
-
Example:
-
-
scrolldelay
-
Defines the delay between each scroll movement (in milliseconds).
-
Example:
-
-
loop
-
Defines how many times the marquee will scroll.
-
Default: infinite.
-
Example:
-
-
bgcolor
-
Sets the background color of the marquee area.
-
Example:
-
-
width & height
-
Defines the marquee area size.
-
Example:
-
Examples (Marquee Tag in HTML)
Example 1: Basic Scrolling Text
Example 2: Scroll Direction
Example 3: Behavior Types
Example 4: Speed Control
Example 5: Image inside Marquee
Example 6: Marquee with Background and Size
Important Notes
-
<marquee>
is deprecated in HTML5 (not recommended for new projects). -
Modern alternatives: CSS animations or JavaScript for scrolling effects.
-
Example using CSS (recommended):