Open In App
Related Articles

How to move a text in HTML ?

Improve Article
Improve
Save Article
Save
Like Article
Like

Some content of a website is like an alert or notification/information that has to be shown to each and every person who is using the website. It has to be placed at some point where everyone can see it.

In this article, we will learn how to create moving content on your website using HTML <marquee> tag. The <marquee> tag in HTML is used to create scrolling text or images on a webpage. It scrolls either from horizontally left to right or right to left, vertically from top to bottom or bottom to top.

Syntax:

<marquee> Contents... </marquee>

Approach:

  • Create a simple HTML file in any text editor.
  •  Add the text you want to move inside the <marquee> tag.

Example 1: In this example, we will see the use of a <marquee>.

HTML




<!DOCTYPE html>
<html>
 
<body>
    <h2>Welcome To GFG</h2>
    <marquee> Lets Move this text.</marquee>
    <marquee direction="right"
             behavior="alternate"
             style="border:BLACK 2px SOLID">
        Geeks for Geeks
    </marquee>
</body>
 
</html>

Output:

Example 2: In this example, we will see the use of a <marquee> with width. 

HTML




<!DOCTYPE html>
<html>
<head>
    <title>HTML marquee Tag</title>
    <style>
        #gfg {
            color: green;
            font-size: large;
        }
    </style>
</head>
<body>
    <marquee width="50%"
             id="gfg">
        Geeksforgeeks
    </marquee>
</body>
</html>

Output:

How to move a text in HTML ?

How to move text in HTML?


Last Updated : 31 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials