To relocate text in HTML, we need to adhere to the following set of instructions. By following these guidelines, we can effectively shift the text.
Step 1: To begin, we need to input the HTML code into a text editor or open the current HTML file in the text editor where we intend to relocate the text.
<!Doctype Html>
<Html>
<Head>
<Title>
Move the text
</Title>
</Head>
<Body>
Hello User!... <br> <center>
You are at C# Tutorial Site!!!.....
</Body>
</Html>
Step 2: Now, we have to place the cursor before that text which we want to move. And, then we have to define the <marquee> tag, which is used for moving the text on the web page. So, type the open <marquee> tag before the text we want to move and close the <marquee> tag just after that text.
<marquee>
Any Text
</marquee>
Step 3: Typically, the default movement of text on a webpage is from the right to the left. In cases where a specific direction needs to be indicated, the direction attribute within the <marquee> tag must be defined.
<marquee direction="right">
Any Text
</marquee>
Step 4: To achieve alternating left-to-right and right-to-left movement of text, it is necessary to define the behavior attribute within the <marquee> tag.
<marquee direction="right" behavior="alternate">
Any text
</marquee>
Step 5: To define the background of the moving text on a webpage, we need to utilize the background property within the style attribute, demonstrated in the code snippet below:
<marquee direction="right" behavior="alternate" style="background:blue;" >
Any text
</marquee>
Step 6: To define the border, the border property within the style attribute needs to be utilized.
<marquee direction="right" behavior="alternate" style="border:RED 3px SOLID" >
Any text
</marquee>
Step 7: Finally, it is essential to save the HTML file and then proceed to open the file in a web browser.
<!Doctype Html>
<Html>
<Head>
<Title>
Move the text
</Title>
</Head>
<Body>
Hello User!... <br> <center>
<marquee direction="right" behavior="alternate" style="background:blue;border:RED 3px SOLID" >
You are at C# Tutorial Site!!!.....
</marquee>
</Body>
</Html>
The result of the HTML code above can be viewed in the screenshot provided below: