Marquee HTML Code Example: Learn With Live Demo

The Marquee element is an HTML tag that allows you to create scrolling or looping text, offering a dynamic and eye-catching way to display content on your webpages. Let's dive into understanding and utilizing this engaging HTML feature.

Marquee in CSS - Beginner's Guide
Marquee in CSS - Beginner's Guide

In the early days of the internet, the marquee tag was extensively used to create dynamic, moving content. Though it's not as popular today as it once was due to CSS advancements, there are still instances where it can add a touch of old-school charm or retro appeal to your website's design.

Marquee tag attributes
Marquee tag attributes

Basics of Marquee Tag

The marquee tag is pretty straightforward to implement, offering several attributes to customize your scrolling text. The most basic use involves simply wrapping your text between the opening <marquee> and closing </marquee> tags:

Etiqueta Marquee HTML
Etiqueta Marquee HTML

<marquee>This is scrolling text</marquee>

Customizing scroll direction

CSS-Only Marquee Effect - Menu Hover Effect - Coding - Fribly
CSS-Only Marquee Effect - Menu Hover Effect - Coding - Fribly

The direction of the scrolling can be customized using the direction attribute. The default value is "left", but you can also set it to "right", "up", or "down".

<marquee direction="right">This text will scroll from left to right</marquee>

Speed settings

Marquee in CSS - Beginner's Guide
Marquee in CSS - Beginner's Guide

The speed at which the text scrolls is determined by the behavior attribute. Values can be "scroll", "alternate", "slide", or "center" (with alternate and center being less common). The speed in pixels per second can also be directly set using the scrollamount attribute.

<marquee behavior="alternate" scrollamount="3">This text will scroll at a speed of 3 pixels per second</marquee>

Advanced Marquee Usage

Magic Navigation Menu, HTML and #CSS
Magic Navigation Menu, HTML and #CSS

For more intricate display, you can use the loop and bgcolor attributes. The former dictates the number of times the text will scroll (default is "infinite"), while the latter changes the background color behind the text.

Here's an example using both these attributes:

Pure CSS 3D Marquee Text Animation Effect
Pure CSS 3D Marquee Text Animation Effect
17 Simple HTML Code Examples You Can Learn in 10 Minutes
17 Simple HTML Code Examples You Can Learn in 10 Minutes
#html #webdevelopment #frontend #programming #coding #javascript #webdesign #learntocode #developers #techsuggester | Tech Suggester
#html #webdevelopment #frontend #programming #coding #javascript #webdesign #learntocode #developers #techsuggester | Tech Suggester
HTML simple code
HTML simple code
How do I put text on a slider image in HTML?
How do I put text on a slider image in HTML?
CSS Gradient Card Border Animation
CSS Gradient Card Border Animation
an image of a screen shot of a web page with the text headings highlighted
an image of a screen shot of a web page with the text headings highlighted
marquee tag in html - தமிழில் (html tags) #shorts
marquee tag in html - தமிழில் (html tags) #shorts
Magic Indicator Menu Using HTML CSS
Magic Indicator Menu Using HTML CSS
an orange and white poster with the words html cheatt written in different font styles
an orange and white poster with the words html cheatt written in different font styles
𝙃𝙏𝙈𝙇 𝙏𝙖𝙜𝙨 𝙘𝙝𝙚𝙖𝙩 𝙨𝙝𝙚𝙚𝙩
𝙃𝙏𝙈𝙇 𝙏𝙖𝙜𝙨 𝙘𝙝𝙚𝙖𝙩 𝙨𝙝𝙚𝙚𝙩
an image of a computer screen with the words html and css written in it
an image of a computer screen with the words html and css written in it
an image of the back side of a computer screen with text that reads, add css to html
an image of the back side of a computer screen with text that reads, add css to html
a computer screen with some type of programming program on the back ground, and an image of
a computer screen with some type of programming program on the back ground, and an image of
using HTML and CSS create a beautiful flower #codet #htmlcss #project #code #programmer #codinglife
using HTML and CSS create a beautiful flower #codet #htmlcss #project #code #programmer #codinglife
the back side of a black and pink web page with text on it, which is also
the back side of a black and pink web page with text on it, which is also
Login and Registration Form in HTML & CSS
Login and Registration Form in HTML & CSS
a close look at tags info sheet
a close look at tags info sheet

<marquee loop="2" bgcolor="blue">This text will scroll twice with a blue background</marquee>

Using multiple Marquee tags

To display multiple lines of Marquee text, you can simply insert them one above the other. This can create a rather mesmerizing effect on your webpage:

<marquee>First line of text</marquee>
<marquee>Second line of text</marquee>

Remember, the marquee tag is not supported in modern CSS standards and might not display correctly on all web browsers. Always test your webpage thoroughly before deploying it.

While the marquee tag is a window into the past of web design, it's also a reminder of the ever-evolving nature of the internet. Embrace this touch of nostalgia, but always strive to strike a balance between innovation and tradition in your web design journey.

Related Articles

Greek Alphabet Html Code Img Tag Html With Url Marquee Html Meaning What Tag Is Used To Display An Image In Html Flask Tutorials Python Type Greek Characters Flask Tutorial Python 3 Html Greek Letter Example Image Tag Html What Is Image Tag In Html Describe With Example