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

Solution using CSS Flexbox

Fatima GRโ€ข 70

@FatimaGR

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


Hi! I would appreciate it if you give me feedback on how I use flexbox in this project to center the QR card

Community feedback

@MelvinAguilar

Posted

Hi @FatimaGR ๐Ÿ‘‹, good job for completing this challenge and welcome to the Frontend Mentor Community! ๐ŸŽ‰

Here are some suggestions to improve your code:

To center the element:

  • Use min-height: 100vh to body instead of height: 100% so that it occupies the full height of the screen.
  • Add justify-content: center and align-items: center to body element, these properties will place the card in the center.
  • Remove margin: 6% auto; from the container selector.

More information:

Try to fix the issues indicated by the report in this solution.

Update the image to make it a bit responsive:

img {
    width: 100%;
    object-fit: contain;
    border-radius: 11px;
}

I hope those tips will help you.

Good Job and happy coding !

Marked as helpful

2
Wonski312โ€ข 100

@Wonski312

Posted

Yes as above you can youse justify-content and align-items with flex to centre your box container on the body. Setting img size with px may couse problems with responivnes if you will still use it like that instead of width 100%. And all content could be set with flex direction column Paragraph with title class could have h1 so itโ€™s more semantic and in challenge directions you have font size set to 15px so you could set it straight away in your body set up

Well done and good luck with your next projects

Marked as helpful

1
Lucas ๐Ÿ‘พโ€ข 104,420

@correlucas

Posted

๐Ÿ‘พHi Fatima, congratulations on your solution!๐Ÿ‘‹ Welcome to the Frontend Mentor Coding Community!

Great solution and a great start! From what I saw youโ€™re on the right track. Iโ€™ve few suggestions for you that you can consider adding to your code:

  • Use <main> instead of a simple <div> this way you improve the semantics and accessibility showing which is the main block of content on this page. Remember that every page should have a <main> block and that <div> doesn't have any semantic meaning.
  • Replace the <h2> containing the main title with <h1> note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading. Use the sequence h1 h2 h3 h4 h5 to show the hierarchy of your titles in the level of importance, never jump a level.
  • Add a margin of around margin: 20px to avoid the card touching the screen edges while it scales down.

Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/qr-code-component-vanilla-cs-js-darklight-mode-nS2aOYYsJR

โœŒ๏ธ I hope this helps you and happy coding!

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