HTML Marquee Tag

王林
Release: 2024-09-04 16:23:04
Original
1112 people have browsed it

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 This is scrolling of the text…, 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 element. The syntax can be written as shown below:

<html>
<body>
<marquee direction="up" height="150" width="250" bgcolor="white">This is scrolling of the text...</marquee>
</body>
</html>
Copy after login

Attributes of HTML Marquee Tag

Following are the attributes which are supported by the tag.

  1. behavior: The action of scrolling the text which can be one of the values, including alternate, scroll, and slide.
  2. bgcolor: It gives background color.
  3. direction: It specifies the direction for scrolling the text with left, right, up and down values. The default direction value is left.
  4. height: It defines a height for the marquee.
  5. hspace: This attribute provides horizontal space around the marquee element.
  6. loop: It defines how many times the text can be scrolled. The marquee will loop continuously if the default value is -1.
  7. scrollamount: It specifies the scrolling amount for each interval. If there is no scrollamount defined, then the default value is 6.
  8. scrolldelay: It gives the scrolling delay in milliseconds. If there is no scrollamount defined, then the default value is 6.
  9. truespeed: It is used to indicate the scrolldelay value of 60.
  10. vspace: This attribute provides vertical space around the marquee element.
  11. 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>
Copy after login

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

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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>
Copy after login

Output:

HTML Marquee Tag

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!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!