blob: 7b8307b4fbc73187fea52dd8ce9dc86a4a0a3197 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
<!DOCTYPE html>
<html>
The green square below should be centered.
<div style="width: 400px; height: 400px; position: absolute;
perspective: 600px; left: 50%; top: 50%; background: green;">
</div>
<script>
document.body.offsetWidth;
document.querySelector("div").style.transform = "translate(-50%, -50%)";
</script>
</html>
|