Home >Web Front-end >HTML Tutorial >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>
Following are the attributes which are supported by the
Following are the examples of the HTML marquee tag explained below:
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:
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:
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:
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:
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:
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:
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:
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!