Home
CSS
CSS 2D Transforms
Tryit: The translate() method
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> div { width: 300px; height: 100px; background-color: yellow; border: 1px solid black; transform: translate(50px,100px); } </style> </head> <body> <h1>The translate() Method</h1> <p>The translate() method moves an element from its current position:</p> <div> This div element is moved 50 pixels to the right, and 100 pixels down from its current position. </div> </body> </html>