---
title: Move an image element on a HTML page with CSS | TestingBot
description: Learn what it takes to move a DOM element or image on a HTML page with
  CSS or the marquee tag.
source_url:
  html: https://testingbot.com/software-testing-questions/move-image-in-html
  md: https://testingbot.com/software-testing-questions/move-image-in-html.md
---

# Learn how to move a DOM element

- [![Share on Facebook](https://static.addtoany.com/buttons/facebook.svg) ](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname= "Share on Facebook")
- [![Share on Twitter](https://static.addtoany.com/buttons/twitter.svg) ](https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname= "Share on Twitter")
- [![Share on LinkedIn](https://static.addtoany.com/buttons/linkedin.svg) ](https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname= "Share on LinkedIn")
- [![Share on HackerNews](https://static.addtoany.com/buttons/y18.svg) ](https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname= "Share on HackerNews")

## How do I move an image in HTML?

If you are looking to move an image on a HTML page, there are various techniques you can use:

- [CSS transform](https://testingbot.com#transform)
- [CSS position](https://testingbot.com#position)
- [CSS animation](https://testingbot.com#animation)
- [marquee tag (deprecated)](https://testingbot.com#marquee)

## Moving image with CSS transform

The transform property allows you to rotate, move, skew and scale any DOM element. Using this technique, you can move an image on an HTML-based page.

```html
<img src="random_image.png" style="transform: translate(30px,60px);">
```

## Using CSS position to move an image

The position property lets you position an element relative to its parent container. Use the position property to indicate how to move the DOM element. Then you can use the `left`, `right`, `top` and `bottom` attributes to indicate the position of the DOM element.

```html
<div style="position: relative;">
   <img src="random_image.png" style="position: absolute; left: 30px; top: 60px;">
</div>
```

## Using CSS animation to move an image

The animation property allows you to create a CSS animation for a specific DOM element. You can use different animation properties to move the element, specifically you can use `animation-name`, `animation-duration`, `animation-timing-function`, `animation-delay` and more.

## marquee tag (deprecated)

The `<marquee>` tag can also be used to wrap an img tag and move it either horizontally or vertically. This tag has been deprecated in HTML5 and is [no longer supported in some browsers](https://caniuse.com/?search=marquee).

- [![Share on Facebook](https://static.addtoany.com/buttons/facebook.svg) ](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname=)
- [![Share on Twitter](https://static.addtoany.com/buttons/twitter.svg) ](https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname=)
- [![Share on Linkedin](https://static.addtoany.com/buttons/linkedin.svg) ](https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname=)
- [![Share on Hacker News](https://static.addtoany.com/buttons/y18.svg) ](https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fmove-image-in-html.md&linkname=)

 ![TestingBot Logo](https://testingbot.com/assets/logo-head-2f7f08db4ac9c4a3b1a784047410f8a4ece708e7e9f10ed16e20fdd8310f8de3.svg)

## Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

[Start Free Trial](https://testingbot.com/users/sign_up)

## Other Questions

### [How can I check my Screen Resolution?](https://testingbot.com/software-testing-questions/how-to-check-my-screen-resolution "How can I check my Screen Resolution?")

### [Learn about Chromedriver and Chrome automation](https://testingbot.com/software-testing-questions/what-is-chromedriver "Learn about Chromedriver and Chrome automation")

### [Centering an image with HTML and CSS](https://testingbot.com/software-testing-questions/how-to-center-an-image-in-html "Centering an image with HTML and CSS")

### [Regression Testing : Definition, How it works](https://testingbot.com/software-testing-questions/what-is-regression-testing "Regression Testing : Definition, How it works")

### [Updating Safari on an older macOS version](https://testingbot.com/software-testing-questions/how-to-update-safari-on-an-old-mac "Updating Safari on an older macOS version")

### [Use Faker to generate random data for your tests](https://testingbot.com/software-testing-questions/how-to-generate-fake-data "Use Faker to generate random data for your tests")
