SyntaxFix
Write A Post
Hire A Developer
Questions
It will work for any object. Even if you don't know the size:
.centered { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); }