Submitted 9 months ago
Qr code card using CSS position relative and fixed
@adriennecarlocortez
Design comparison
SolutionDesign
Solution retrospective
I find problems when centering the card, I tried using margin auto but the top margin is not centering. To solve this problem I used position relative and fixed, to even the margins in all sides
.container {
position: relative;
}
.even-margin {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Is this the best practice? Should I use flexbox or another method instead?
Community feedback
- @comfortprincePosted 9 months ago
You can use grid on the container
display: grid; place-items: center;
Marked as helpful1
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