<!DOCTYPE html> | |
<style> | |
#target { | |
position: absolute; | |
width: 100px; | |
height: 100px; | |
background: blue; | |
transform: translate(calc(50vw - 50px), calc(50vh - 50px)); | |
} | |
</style> | |
This box should be located in the center of the page. | |
<div id="target"></div> | |
<script> | |
window.resizeTo(window.innerWidth / 2, window.innerHeight / 2); | |
</script> |