Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 1 year ago

QR Code Component Challenge, using Flexbox

dweemon•10
@dweemon
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


A challenge I had with this project was figuring out the proper way to separate my code so it is cohesive to anyone reviewing, as well as whether it followed the correct semantical order.

Another issue I had was being unsure if I was using units in order to adjust the position of my components. Should I be using px? rem? em? What is most recommended when designing a webpage so everything stays where I would want it to be.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Account deletedPosted over 1 year ago

    @dweemon, good job on completing the challenge. It would be a good idea and great practice to play around with sr-only for accessibility purposes it's essentially for screen readers, you've already done it by putting text on you image using the alt tag. You can do a very simple one using the h1 tag element simply give it a class name of sr-only then put this code in your css:

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: hidden;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border-width: 0;
    }
    

    this won't be seen on screen but will be read out loud to people who are blind or have other disabilities that are using screen readers.

  • Melvin Aguilar 🧑🏻‍💻•61,020
    @MelvinAguilar
    Posted over 1 year ago

    Hello there 👋. Good job on completing the challenge !

    I have other suggestions about your code that might interest you.

    • Wrap the page's whole main content in the <main> tag.

    • Instead of using pixels in font-size, use relative units like em or rem. The font-size in absolute units like pixels does not scale with the user's browser settings. Resource 📘.

    I hope you find it useful! 😄

    Happy coding!

  • Dilhan Boca•220
    @dboca93
    Posted over 1 year ago

    Hello @dweemon,

    Congratulations on submitting this task. Instead of playing around with position and then amending the margin, it would be easier to use a main inside the body element (that has the rest of the code in it) with the following code:

    main { width: 100vw; min-height: 100vh; display: flex; align-items: center; justify-content: center; }

    This might be easier, especially going into the future, I remember not finding out about viewport units quiet late, this will hopefully make it much easier for you !

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 1st-party linked stylesheets, and styles within <style> tags.

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.

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

Oops! 😬

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

Log in with GitHub