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

CSS column flex

Muhammad 90

@code-Allahtosin

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 was wondering if there's a better way to implement centring the page vertically.

Community feedback

@iammiracle01

Posted

Hi Muhammad, nice solution using CSS flex. By the way a better way for centering the page vertically is by including the following into your container styles:

  1. display:flex into
  2. set the flex-direction:column;
  3. then use the align-items:center to properly center your container on the page.

You can also add margin: 5rem auto .

Lastly, I'd suggest you remove the width and text-align property on your body tag.

Hope this helps, happy coding.

0

@ziy-eg

Posted

I love your code.

about your question for centering any item: try this code: <code> position: absolute; top: 50%; left: 50%; </code> this code will put the left-top corner of the item on the page center, so to make it work on the whole item you have to add another code to it.

<code> transform: translate(-50%, -50%); </code> that would move the left-top corner 50% up and left making the center point of the item in the center of the main container.. (makes it look like dealing with the center point)

keep the good work..

0

Muhammad 90

@code-Allahtosin

Posted

@ziy-eg perfect, thanks!

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