Marquee Codes
This page contains marquee codes. Feel free to copy and paste the marquee codes into your own website, blog, MySpace page, or other HTML document. And feel free to modify the code as you wish.
Also, please consider keeping the link back to this website - if you do it will be very much appreciated!
Continuous Scrolling Marquee Code
The following example demonstrates what the basic HTML marquee code does. The marquee
tag allows stuff (i.e. text, images, etc) to scroll across the page.
Using behavior="scroll"
sets the marquee to scroll continuously - that is, every time the text has scrolled all the way across, it starts again. It's basically in a loop. We set its direction using the direction
.
Horizontal Marquee
This HTML marquee is scrolling horizontally from right to left. Although this tends to be the default, you can specify direction="left"
in the HTML code. You can also set it to right
, up
, and down
(see below).
Source Code |
Result |
|
|
Vertical Marquee Code
Here, the text scrolls upward. This is acheived by using both behavior="scroll"
and direction="up"
. You could change this to direction="down"
if you prefer.
Source Code |
Result |
|
|
Slide-in Marquee Code
This example sets the text to slide in, and then stay there. It doesn't loop continuously like the above examples. It simply slides in, then stops. This is acheived by using behavior="slide"
.
Tip: If you don't see the text sliding in here, refresh the page - the text probably slid in before you noticed it!
Source Code |
Result |
|
|
Bouncing Marquee Code
Here, the text bounces back and forth. This is acheived by using behavior="alternate"
.
Source Code |
Result |
|
|
Marquee Speed
You can speed up or slow down your marquees by using the scrollamount
attribute along with a numeric value. Here, we use several values to set different marquees speed.
Source Code |
Result |
|
|
Scrolling Images
You can also make images scroll. To do this, simply add image code within the marquee
tag instead of text. Here, we add an animated gif - one which suits the scrolling motion of the marquee.
Source Code |
Result |
|
|
Images and Text
There's nothing to stop you putting more than one HTML element inside your HTML marquee codes. Doing so will make both scroll.
Source Code |
Result |
|
|
Marquee Attributes
The <marquee>
tag accepts a number of attributes (some of which are included in the above examples). Feel free to experiment with these settings to see the effect they have on your scrolling text. The full list of attributes are:
width |
Sets the width of the marquee |
scrollamount |
How far to jump as it moves |
height |
Sets the height of the marquee |
loop |
How many times it should loop |
direction |
Sets the direction of the marquee |
bgcolor |
Sets the background color of the marquee |
behavior |
Whether to slide, bounce, or scroll |
hspace |
Sets the amount of horizontal space around the marquee |
scrolldelay |
How long the marquee should wait before each jump |
vspace |
Sets the amount of vertical space around the marquee |