marquee (HTML element)

Share this article

Syntax

<marquee align=" { top | middle | bottom } " behavior=" { scroll | slide | alternate } " direction=" { left | right } " loop="value (number of loops)" bgcolor="color name or hex value" height="integer (pixels or %)" width="number (pixels or %)" hspace="integer (pixels or %)" vspace="number (pixels or %)" scrollamount="number" scrolldelay="number">
</marquee>

Description

The marquee element provides a way for browsers to render text that moves across the page without having to resort to JavaScript techniques. The marquee is non-standard but enjoys (or possibly suffers from) good browser support. It is generally considered to be a very unfriendly element to use, one which presents difficulties for many users who may have difficulty tracking the text as it moves. Our advice is not to use it. JavaScript is a more suitable technique for moving text on screen – if there is a valid reason for doing this at all.

Example

A simple marquee with no additional attributes is marked up as follows:

<p><marquee>This text is a moving target. Don't you just love
it?</marquee></p>

Use this for…

The marquee element should contain a short amount of text.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full
Support for marquee is varied. Some browsers will stop animation regardless of loop settings, some interpret direction differently, some will honor height and width attributes, most pay no attention at all. However, given that this is not part of any HTML recommendation, this is perhaps to be expected. The simple answer is not to use it if you want to have valid documents that render consistently and don’t annoy the heck out of the reader.

Frequently Asked Questions about HTML Marquee Element

What is the HTML Marquee Element and how is it used?

The HTML Marquee Element is a non-standard HTML element that is used to create scrolling text or images on a web page. It can be used to draw attention to important information or to create visually appealing effects. To use the marquee element, you simply wrap the content you want to scroll in the and tags. For example, This text will scroll.

Is the HTML Marquee Element supported by all browsers?

The HTML Marquee Element is not a standard HTML element and therefore its support varies across different web browsers. While it is supported by most browsers, some may not support it or may not support all of its attributes. Therefore, it’s recommended to use CSS animations for creating scrolling effects as they are more widely supported and offer more control.

How can I control the speed and direction of the scrolling in the HTML Marquee Element?

The speed and direction of the scrolling in the HTML Marquee Element can be controlled using the “scrollamount” and “direction” attributes respectively. The “scrollamount” attribute determines the speed of the scrolling, with higher values resulting in faster scrolling. The “direction” attribute determines the direction of the scrolling and can be set to “left”, “right”, “up”, or “down”.

Can I make the scrolling stop when the mouse hovers over the HTML Marquee Element?

Yes, you can make the scrolling stop when the mouse hovers over the HTML Marquee Element by using the “onmouseover” and “onmouseout” event attributes. The “onmouseover” attribute can be used to stop the scrolling when the mouse hovers over the element, and the “onmouseout” attribute can be used to resume the scrolling when the mouse leaves the element.

Can I use the HTML Marquee Element to scroll images?

Yes, you can use the HTML Marquee Element to scroll images. To do this, you simply place the tag inside the tag. For example, .

Can I control the number of times the content scrolls in the HTML Marquee Element?

Yes, you can control the number of times the content scrolls in the HTML Marquee Element using the “loop” attribute. The “loop” attribute determines the number of times the content will scroll. If you want the content to scroll indefinitely, you can set the “loop” attribute to “infinite”.

Can I scroll multiple lines of text with the HTML Marquee Element?

Yes, you can scroll multiple lines of text with the HTML Marquee Element. To do this, you simply place each line of text within its own

tag inside the tag. For example,

Line 1

Line 2

.

Can I use CSS with the HTML Marquee Element?

Yes, you can use CSS with the HTML Marquee Element to style the scrolling content. You can apply CSS styles to the tag itself or to the content inside the tag.

Is the HTML Marquee Element deprecated?

Yes, the HTML Marquee Element is deprecated in HTML5 and is not recommended for use in new projects. Instead, it’s recommended to use CSS animations for creating scrolling effects as they are more widely supported and offer more control.

Can I use the HTML Marquee Element to create a slide show?

While it’s technically possible to use the HTML Marquee Element to create a slide show by scrolling images, it’s not the best tool for the job. The HTML Marquee Element is deprecated and may not be supported by all browsers. Instead, it’s recommended to use CSS animations or JavaScript for creating slide shows.

Adam RobertsAdam Roberts
View Author

Adam is SitePoint's head of newsletters, who mainly writes Versioning, a daily newsletter covering everything new and interesting in the world of web development. He has a beard and will talk to you about beer and Star Wars, if you let him.

Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week