Skip navigation

Adding a Marquee

How to add a marquee to your Web page
Note: This is non-standard code... but is presented here for the fun of it!

The marquee tag allows you to scroll some text of your choice across the screen, and it doesn't need a JavaScript to make it work. The only problem with using it (aside from possibly irritating your visitors!) is that the marquee tag only works in Internet Explorer (and a few other browsers). Other browsers will just show the text you wanted to scroll as plain text on the screen.

If you are using IE, here is the code to get a marquee to work:

<marquee loop="infinite">Your choice of text here</marquee>

The loop="infinite" tells the text to scroll for as long as the page is open in the browser. More on that, plus some other options, in a moment. For now, let's look at an example. The code below creates our example marquee:

<marquee loop="infinite">
Scrolling text is so much fun.....I can scroll forever!
</marquee>

This code will give you the scrolling text below. It makes the page have quite an interesting effect:

Scrolling text is so much fun.....I can scroll forever!

What else can you do? Well, there are several attributes you can add to the marquee tag to make the scrolling text more entertaining:

loop=" "

We used loop="infinite" in our example, but you can change this to loop="1" loop="2" and so on. This will tell the browser to scroll the text the number of times you set it to. So, loop="1" will scroll the text only once.

bgcolor=" "

This allows you to change the background color of the area the text is scrolling over. So, if you added bgcolor="yellow", you would have code like this:

<marquee loop="infinite" bgcolor="yellow">
Scrolling text is so much fun.....I can scroll forever!
</marquee>

And the result would be the scrolling text over a yellow background!

Scrolling text is so much fun.....I can scroll forever!

WIDTH=" "

This lets you control the width of the marquee. You can use the number of pixels, or a percentage of the screen. So, here is an example:

<marquee loop="infinite" bgcolor="yellow" width="300">
Scrolling text is so much fun.....I can scroll forever!
</marquee>

And the result:

Scrolling text is so much fun.....I can scroll forever!

Well, that is the marquee. Let's move onto the next section, HTML Table Basics.

 

--------------------
Copyright © 1997-2008 The Web Design Resource. All rights reserved. Disclaimer.