Submitted over 2 years ago
QR code solutions using HTML and CSS
@Jonathanthedeveloper
Design comparison
SolutionDesign
Solution retrospective
How do you center your div perfectly?
Community feedback
- @osmannurierdoganPosted over 2 years ago
Hi @Errorman2003,
I centered the div with the following code for this challenge. It may not be the perfect solution but it works for me. :D If you have better solution, you can reply my message, I would be happy for that :)
.customDivItem{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
0 - @daniloarcidiaconoPosted over 2 years ago
If you have only a single tag inside body, you can try to use flexbox:
html, body { height: 100%; } body { display: flex; justify-content: center; align-items: center; }
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord