To return which part of a positioned element is visible, use the clip property in JavaScript.
Example
You can try to run the following code to learn how to clip an image −
<!DOCTYPE html> <html> <head> <style> img { position: absolute; top: 100px; } </style> </head> <body> <button type="button" onclick="display()">Clip</button><br> <img id="newImg" src="https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg" width="170" height="150"> <script> function display() { document.getElementById("newImg").style.clip = "rect(10px 90px 90px 10px)"; } </script> </body> </html>