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 and SASS

#sass/scss
cwatsoβ€’ 70

@cwatso

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


I have used flexbox to center this vertically by setting the height to 100vh, but I am curious if there is a more widely accepted way of doing this? Would love some feedback.

Community feedback

Daniel πŸ›Έβ€’ 43,570

@danielmrz-dev

Posted

Hello @cwatso

The technique you used to center your card is one of the most accepted.

Another way to have the same result is apply this to the element you wanna center:

.element {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
}

I hope it helps!

Marked as helpful

1
enzmrg πŸ’«β€’ 870

@enzo-mir

Posted

Hello ! nice challenge ! To avoid the 100vh on your body try this :

html,body {width : 100%; height:100%}; body {display : grid; place-items : center}

And that's it you have a centered container ! Well done ;)

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