Loading...
HTML Marquee

HTML Marquee Element

In this tutorial, we will learn about marquee tag and its attribute in HTML with the help of examples.


<marquee> Tag

The marquee element is a container tag of HTML.
It scrolls the content inside it either from horizontally (left to right or right to left) or vertically (top to bottom or bottom to top).
By default, the text inside the <marquee> tag will scroll from right to left. It has both an opening and closing tag.

Note : The <marquee> tag has been deprecated (no longer in use) in HTML 5.


<marquee> Tag Attributes

There are some attributes which can be used in <marquee> tag :

Attribute Description
direction It specifies the direction of scrolling the content
bgcolor It specifies the background color of the marquee
width It defines the width of a marquee
height It defines the height of a marquee
hspace It specifies the horizontal space around the marquee
vspace It specifies the vertical space around the marquee
loop It specifies how many times content moves

Example :

<!DOCTYPE html>
<html>
  <head>
    <title>Marquee Tag Attribute</title>
  </head>
  <body>
    <marquee>This is a simple marquee tag.</marquee>
    <marquee direction = "right" bgcolor = "#ff0000">This is a marquee tag with direction attribute.</marquee>
    <marquee bgcolor = "#ffa500">This is a marquee tag with bgcolor attribute.</marquee>
    <marquee width = "300px" bgcolor = "#ffff00">This is a marquee tag with width attrbiute.</marquee>
    <marquee height = "50px" bgcolor = "#008000">This is a marquee tag with height attribute.</marquee>
    <marquee hspace = "50px" bgcolor = "#0000ff">This is a marquee tag with hspace attribute.</marquee>
    <marquee vspace = "50px" bgcolor = "#4b0082">This is a marquee tag with vspace attribute.</marquee>
    <marquee loop = "5" bgcolor = "#ee82ee">This is a marquee tag with loop attribute.</marquee>
  </body>
</html>

Output

This is a simple marquee tag.
This is a marquee tag with direction attribute.
This is a marquee tag with bgcolor attribute.
This is a marquee tag with width attrbiute.
This is a marquee tag with height attribute.
This is a marquee tag with hspace attribute.
This is a marquee tag with vspace attribute.
This is a marquee tag with loop attribute.

Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of Marquee in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML CSS.

- Related Topics