<script> function yf(){ var x=document.getElementById("odiv").innerHTML; var y=document.getElementById("yb"); y.innerHTML=x; y.style.border="thick solid #0000FF"; y.style.padding="5px"; y.style.position ="absolute" ; y.style.left="300px" ; y.style.width="350px" ; } </script> <div id="odiv"> <h2>This is a div with an absolute position</h2> <img src="https://www.levelextreme.com/thread/00079336.jpg" width='100' height='100'> <p id="yb1" >With absolute positioning, any element can be placed anywhere on a page. The div below is placed 300px from the left of the page and 350px from the top of the page. All styles can be done with DOM syntax (even out of javascript ,from visual foxpro codings). for more info:can search in https://www.w3schools.com/ (very usefull). </p> </div> <hr> <div id='yb'></div> <br> <button style="cursor:pointer;float:right;" onclick="yf()">Click me</button>