VOOZH about

URL: https://www.geeksforgeeks.org/html/how-to-move-image-in-html/

⇱ How to Move Image in HTML? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Move Image in HTML?

Last Updated : 23 Jul, 2025

The <marquee> tag in HTML allows you to create scrolling effects for images, making it a simple way to add dynamic movement to your webpage. Images can scroll horizontally or vertically, with various attributes controlling the direction and behavior of the movement.

Syntax

<marquee>
<img src="image.jpg" alt="Scrolling Image">
</marquee>

Attributes of <marquee> Tag

The <marquee> tag supports several attributes that define the scrolling behavior:

Attributes

Description

direction

Sets the direction for the scrolling images. The value of this attribute can be left, right, up, or down.

behavior

The behavior tells about how the text scrolls. It can be one of the following values which are alternate, scroll, slide, etc.

Example 1: Scrolling Images Using the <marquee> Tag

In this example, we will use the <marquee> tag to move images. The first image will scroll from right to left, while the second image will scroll vertically upwards.

Output:

Example 2: Moving Images Back and Forth Using the behavior Attribute

Here, we will demonstrate how to use the behavior="alternate" attribute to make the images move back and forth within the <marquee> container.

Output:

Comment