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

Responsive QR-Code centralized with "position: absolute;"

@IrineuRastero

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?

Being able to code my first page without handholding. I would like to do it faster next time :-D

What challenges did you encounter, and how did you overcome them?

The biggest challenge for me was centralizing the main element of the page while making it responsive, as said in the title I overcame this fixing the position to the center of the screen with the following snippet:

position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

What specific areas of your project would you like help with?

I would like to know how to get the feel for the size of the things on the preview, this was also one of the things I had difficulty with.

Community feedback

Rodri 100

@rcsilva211

Posted

The solution itself is great for this example, but from experience and after you've mentioned you fix to center the container, I can share that display: flex already does that for you :)

Here's my snippet:

.container {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: hsl(212, 45%, 89%);
      }

When setting the width and height to 100%, the container will occupy the entirety of its parent, in this case being the body. The display: flex will make it can be automatically be arranged keeping in consideration the elements inside; The justify-content: center will make it so it distributes the contents around the container (in this case, will place them to the center); The align-items: center will align all the contents of the flexbox in the vertical axis.

You can check W3Schools for more information about this: CSS Flexbox Container - W3 Schools

0

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