HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ position: relative; border: 1px solid black; height: 250px; } img{ position: absolute; } </style> </head> <body> <h1>CSS right Property</h1> <div> <img src="apple.png"> </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("img")[0]; function myFunction(){ x.style.right = "20%"; } </script> <p><strong>Note</strong>: Click on the button to start the image from 20% from the right of the div.</p> </body> </html>
OUTPUT
×

Save as Private