HTML Marquee Tag
Marquee tag in HTML is used for creating a scroll over the text or the image in the web page, which allows all types of scrolls like left to right, right to left, top to bottom and bottom to top. The syntax for this tag in HTML is
, where the ‘marquee’ tag is used to describe the properties of the required scroll. A few other commonly used marquee attributes are behaviour, hspace, scrollamount, scrolldelay, truespeed, vspace, etc.Syntax:
The marquee can be used by using the
<html> <body> <marquee direction="up" height="150" width="250" bgcolor="white">This is scrolling of the text...</marquee> </body> </html>
Attributes of HTML Marquee Tag
Following are the attributes which are supported by the
- behavior: The action of scrolling the text which can be one of the values, including alternate, scroll, and slide.
- bgcolor: It gives background color.
- direction: It specifies the direction for scrolling the text with left, right, up and down values. The default direction value is left.
- height: It defines a height for the marquee.
- hspace: This attribute provides horizontal space around the marquee element.
- loop: It defines how many times the text can be scrolled. The marquee will loop continuously if the default value is -1.
- scrollamount: It specifies the scrolling amount for each interval. If there is no scrollamount defined, then the default value is 6.
- scrolldelay: It gives the scrolling delay in milliseconds. If there is no scrollamount defined, then the default value is 6.
- truespeed: It is used to indicate the scrolldelay value of 60.
- vspace: This attribute provides vertical space around the marquee element.
- width: It defines a width for the marquee.
Examples of HTML Marquee Tag
Following are the examples of the HTML marquee tag explained below:
Example #1 – Marquee Left
This type of marquee can be used to move the content from the left side.
Code:
<!DOCTYPE html> <html> <head> <title>Left Marquee</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } .txt { font-size:30px; font-weight:italic; color:white; padding-bottom:10px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor = "grey" direction = "left" loop="" > <div class="txt">Welcome to EDUCBA...</div> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
- Save the above code in a file with a .html extension
- Run the HTML file in a browser, and you would get the output as shown in the below image
Example #2 – Marquee Right
This type of marquee can be used to move the content to the right side.
Code:
<!DOCTYPE html> <html> <head> <title>Right Marquee</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } .txt { font-size:30px; font-weight:italic; color:white; padding-bottom:10px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor = "grey" direction = "right" loop="" > <div class="txt">Welcome to EDUCBA...</div> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
Example #3 – Marquee Up
This type of marquee can be used to move the content to the upside.
Code:
<!DOCTYPE html> <html> <head> <title>Up Marquee</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } .txt { font-size:30px; font-weight:italic; color:white; padding-bottom:10px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor = "grey" direction = "up" loop="" > <div class="txt">Welcome to EDUCBA...</div> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
Example #4 – Marquee Down
This type of marquee can be used to move the content to the downside.
Code:
<!DOCTYPE html> <html> <head> <title>Down Marquee</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } .txt { font-size:30px; font-weight:italic; color:white; padding-bottom:10px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor = "grey" direction = "down" loop="" > <div class="txt">Welcome to EDUCBA...</div> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
Example #5 – Nested Marquee
This type of marquee can be used to nest the content.
Code:
<!DOCTYPE html> <html> <head> <title>Nested Marquee</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } .txt { font-size:30px; font-weight:italic; color:white; padding-bottom:10px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor = "grey" direction = "down" behavior="alternate" height="150" > <marquee behavior="alternate"><div class="txt">Welcome to EDUCBA...</div></marquee> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
Example #6 – Speed Comparison for Marquee
The speed of the marquee element can be specified by using the scrolldelay attribute.
Code:
<!DOCTYPE html> <html> <head> <title>Nested Marquee</title> <style> .marq_class1 { padding-top:25px; padding-bottom:25px; } </style> </head> <body> <marquee class="marq_class1" bgcolor = "grey" direction = "down" behavior="alternate" height="150" > <marquee scrolldelay="80" scrollamount="7">Welcome to EDUCBA...(normal speed)</marquee> <marquee scrolldelay="60" scrollamount="12" truespeed>Welcome to EDUCBA...(This is very speed)</marquee> <marquee scrolldelay="250" scrollamount="4">Welcome to EDUCBA...(This is very slow)</marquee> </marquee> </body> </html>
Output:
Example #7 – Marque Background Color and Space
This type of marquee can be used to set background color and space for the marquee element.
Code:
<!DOCTYPE html> <html> <head> <title>Marquee Background and Space</title> <style> .mrq_class { text-align:center; } .marq_class1 { padding-top:25px; padding-bottom:25px; } </style> </head> <body> <div class = "mrq_class"> <marquee class="marq_class1" bgcolor="#d9d9ff" hspace="50" vspace="20"> <div>EDUCBA is a leading global provider of skill based education addressing the needs 500,000+ members across 40+ Countries.</div> </marquee> </div> </body> </html>
Output:
Conclusion
So far, we have studied how the marquee tag will be used to create scrolling text on the webpage. The user can easily create scrolling text horizontally or vertically easily on the websites. This element has been deprecated and will be no longer used. To make the scrolling effect, CSS or JavaScript will be used.
The above is the detailed content of HTML Marquee Tag. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
