Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 5 months ago

QR Code Component

Jin•30
@ri-zal
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I'm most proud of how I decided to style my body element. I think I would try out CSS variables if I could do it differently.

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

I first struggled to figure out how to center the .container class vertically. I first did margin: auto;, which only centered the card horizontally but not vertically. Then I tried,

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

Which didn't fix it. So to get a better idea of how things were positioned I made use of the "box model" concept, kept the flex properties and set a border to all elements using the * selector with border: 1px solid red;. Turns out the body height was too small so I did min-height: 100vh;. This fixed my problem and the card was now centered both horizontally and vertically.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Bhuvnesh Upadhayay•2,120
    @bhuvi819381
    Posted 5 months ago

    Hey brother 👋

    🚀 Your solution looks great! Keep it up! 🎉

    Suggestions for Improvement:

    1. 🛠 Use Semantic Tags

    Wrap your main content inside a <main> tag instead of a <div>.

    Use <section>, <article>, <footer>, etc., to improve structure.

    1. 📏 Avoid Fixed Heights

    Instead of height: 500px;, use min-height: 100vh; if needed.

    Let content define its own height to make it more responsive.

    1. ❌ Don’t Use px

    Instead, use relative units like rem, em, %, vh, or vw for better responsiveness.

    1. Use 1 h1 per page
    2. Fix Heading Hierarchy

    Ensure headings follow a logical order (h1 → h2 → h3…). This improves SEO & accessibility.


    Additional Suggestions:

    🛠️ Check for Errors: After submitting, always review the HTML & accessibility error report and fix any issues.

    🔥 You're improving with every project! Keep it up! 🚀

    Best regards, A Frontend Friend

    Marked as helpful
  • P
    Kamran Kiani•2,780
    @kaamiik
    Posted 5 months ago

    Your code structure really well and CSS is very good too. Congrats. Just a few notes:

    1. Try to use a proper CSS reset at the start of your CSS style. Andy Bell and Josh Comeau both have a good one. You can simply search on the internet to find them. It may not very usable here but in the future you need.

    1. You do not need position: relative; bottom: -200px;. This cause scrolling and it's not proper. You should use flex here. Your body is display: flex; so You have two child and one of them should grow. You also need a little change into your html and css as the main should not get any style and use a div as a direct child of main and put all of your contents inside of it.

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub