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 Challenge

IanV 90

@ivdevelopment

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 having some troubles with centering the container to the middle of the screen. It works fine when I try to do it horizontally but whenever I try to center it vertically I fail.

If anybody got any tips on how I can do this better please do :)

Community feedback

@sophiakoulen

Posted

Hi!

Your solution looks good. Here are my thoughts on your code:

I wouldn't personnaly use the <br> tag to force line breaks since you might want your component to adapt to multiple screen sizes.

I found that putting most of your code in a media query makes it less readable. I'd put only the things that change inside a media query and avoid them if i can find another solution. (For example, using vwas a unit, using the modern clamp(), min(), max()to adapt widths or font-sizes.)

I'm curious as to why you chose display:inline-block;.

A quick fix for the vertical centering is to have a height:100vh on your .screen, and either use

display:flex;
align-items:center;
justify-content:center;

Or

display:grid;
place-items:center;

Hope this helps!

Marked as helpful

1
Priya Garg 200

@Priya366

Posted

Hi lanV Good job! Your code looks good.

As per your question, Your container can be centered vertically and horizontally by using:

body { background: hsl(212, 45%, 89%); padding: 0; margin: 0; width: 100%; box-sizing: border-box; font-family: 'Outfit', sans-serif; display: flex; height: 100vh; flex-direction: column; }

By setting ( flex-direction: column) Both screen and attribution will be directed in column and the card will be centered.

I hope this will be helpful.

Marked as helpful

0

IanV 90

@ivdevelopment

Posted

@Priya366 Hi there! Thank you I really appreciate the help :) Happy coding!

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