Recently, I attempted to vertically center a div on a page with a height of 100vh.
The div has a height of 84px, so I tried using the following CSS:
margin-top: calc(50% - 42px);
Unfortunately, it appears that the browser always considers the width of the outer div instead of its height (100vh). Is there a way to calculate the percentage based on the height of the containing element rather than its width?