Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

QR code component using HTML & CSS

Aditya Rao 190

@thisisadityarao

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

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

John Q. 140

@romrauq

Posted

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 helpful

1

Aditya Rao 190

@thisisadityarao

Posted

@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
T
Grace 29,310

@grace-snow

Posted

@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
John Q. 140

@romrauq

Posted

I 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 GitHub
Discord logo

Join 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