HTML <marquee> Tag

The <marquee> is a non-standard HTML tag which was used to create a scrolling text or an image. It was used to make the text or image scroll horizontally across or vertically down the web page. Because of its usability problems it was often compared with Netscape’s blink element.

HTML marquee tag example
The <marquee> element is a deprecated HTML tag. If you use it, your pages or apps may be broken.

Alternatives of the HTML <marquee> tag

As it was said above, the HTML <marquee> tag is deprecated, and the developers often avoid using it. Nowadays, you can achieve the same result with the help of CSS and Javascript. Read our snippet to learn more about this method.

Syntax

The <marquee> tag comes in pairs. The content is written between the opening (<marquee>) and closing (</marquee>) tags.

Example of using HTML <marquee> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      marquee{
      font-size: 30px;
      font-weight: 800;
      color: #8ebf42;
      font-family: sans-serif;
      }
    </style>
  </head>
  <body>
    <marquee>A scrolling text created with HTML Marquee element.</marquee>
  </body>
</html>

Use direction attribute of <marquee> element to change the direction of the text/image. See another example where the text scrolls from up to down.

Example of a scrolling text:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <marquee direction="down">A scrolling text created with HTML Marquee element.</marquee>
  </body>
</html>

Now let's see an example of using <marquee> element for setting a scrolling image:

Example of a scrolling image:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
     <marquee behavior="scroll" direction="up">
      <img src="/uploads/media/default/0001/01/0710cad7a1017902166203def268a0df2a5fd545.png" width="190" height="45" alt="W3docs" />
    </marquee>
  </body>
</html>
Use CSS width and background-color properties to style the <marquee> element.

Example of creating a scrolling text with HTML <marquee> tag:

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <style> 
      marquee {
        width: 100%;
        padding: 10px 0;
        background-color: lightblue;
      }
    </style>
    <marquee direction="scroll">This scrolling text is created with HTML Marquee element and styled with CSS properties.</marquee>
  </body>
</html>

Attributes

The following attributes can be used to adjust the appearance of the <marquee> element.

Attribute Value Description
behavior scroll
slide
alternate
Defines the scrolling type.
bgcolor rgb(x,x,x)
#xxxxxx
colorname
Is used to give a background color.
direction up
down
left
right
Sets the direction for the scrolling content.
height pixels
%
Defines the marquee's height.
hspace pixels Defines horizontal space around the marquee.
loop number Defines how many times the content will scroll. If we don't define this, the content will scroll forever.
scrollamount number Defines the scrolling amount at each interval in pixels. Default value is 6.
scrolldelay seconds Defines how long delay will be between each jump. The default value is 85 and smaller amounts than 60 will be ignored.
truespeed seconds Is used to delay the scroll lesser than 60.
vspace pixels Defines vertical space around the marquee.
width pixels
%
Defines the marquee's width.

The <marquee> tag also supports the the Global attributes and the Event Attributes.

How to style <marquee> tag?

Common properties to alter the visual weight/emphasis/size of text in <marquee> tag:

  • CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit.
  • CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
  • CSS font-size property sets the size of the font.
  • CSS font-weight property defines whether the font should be bold or thick.
  • CSS text-transform property controls text case and capitalization.
  • CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style.

Coloring text in <marquee> tag:

  • CSS color property describes the color of the text content and text decorations.
  • CSS background-color property sets the background color of an element.

Text layout styles for <marquee> tag:

  • CSS text-indent property specifies the indentation of the first line in a text block.
  • CSS text-overflow property specifies how overflowed content that is not displayed should be signalled to the user.
  • CSS white-space property specifies how white-space inside an element is handled.
  • CSS word-break property specifies where the lines should be broken.

Other properties worth looking at for <marquee> tag:

Browser support

chrome edge firefox safari opera

Practice Your Knowledge

What is the purpose of the HTML marquee tag as described on the given webpage?

Quiz Time: Test Your Skills!

Ready to challenge what you've learned? Dive into our interactive quizzes for a deeper understanding and a fun way to reinforce your knowledge.

Do you find this helpful?