HTML : Centering a div of unknown height and width
Let's create a div with some dummy content as -
<div class="content">This works with any content</div>
Now let's apply some css to allow this content to be in center:
.content {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
I know approx 10-15 ways to center html content, if you're interest then please comment below, I'll write an article on this topic as well.
{% stackblitz web-platform-83ufnu %}
With all that being said, I highly recommend you keep learning!
Thank you for reading this article. Please feel free to connect with me on LinkedIn and Twitter.