marquee (HTML element)

Adam Roberts
Share

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.