Design comparison
Solution retrospective
I learned how to use variable fonts from Google fonts. Project was easy as it is. I would probably use flexbox for something like this from now on.
What challenges did you encounter, and how did you overcome them?Getting the spacing around components just right was really time consuming. Lots of trial and error.
What specific areas of your project would you like help with?I would like to learn the best way to add variable fonts to a project.
Community feedback
- @romrauqPosted 6 months ago
Try centering the application vertically div by using the following CSS properties and values:
.target-div{ position: absolute; top: -50%; transform: translateY(-50%) }
And then remove your current top margin.
Marked as helpful1@thisisadityaraoPosted 6 months ago@romrauq Do I apply
position: relative
to the parent of .target-div for this to work?UPDATE: I ended up using flexbox to center the qr code component.
1@grace-snowPosted 6 months ago@romrauq this wouldn't be a good way to center this component. It's fine for decorative items but you won't want to do that for blocks of content. Position absolute would remove the component from the document flow so when viewed on smaller screens or when people have a larger default text size the component would overflow the screen.
There are modern techniques much better suited to this. Making the wrapper into a flex column with min-height in viewport units and flex centering properties would be a much more robust way to center it.
0@romrauqPosted 6 months agoI may need to relearn the method of using flexbox to center components vertically. 😅
Thanks a lot for your input @grace-snow! 👍🏽
1
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