The html and body is 100vh.
In my body, I have a 100px square.
When I apply top 50% to the div, the div, moves down 50%. But when I do apply translateY(50%) on the div, the div does not move down 50%?
Why is this?
Note: you have to open the html in a full page to see that the div does not move 50% down.
* {
padding: 0;
margin: 0;
}
html, body {
height: 100vh;
width: 100vw;
}
body {
position: relative;
background-color: black;
}
div {
height: 100px;
width: 100px;
background-color: orange;
position: absolute;
/* top: 50%; */
transform: translateY(50%);
}
<div></div>