Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

QR-code challenge HTML & CSS

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

Solution retrospective


I used HTML and CSS. I centered the whole thing with Flexbox, I don't know if that was the right way to go though? The readme file of the challenge gave the width for mobile and desktop. But I didn't use that in my code, how should I use this? When checking in inspector mode in chrome on the exact width of the mobile version it already looked exactly as it should be without having to do anything in CSS to scale it, is this because of flexbox?

Feedback is welcome. I was wandering if I was using things that are unnecessary. Also, for some reason the live deployment of github doesn't show the image...?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Fer•3,970
    @fernandolapaz
    Posted about 2 years ago

    Hi 👋, regarding your questions:

    🔹The widths given in the style guide are only for the purpose of having them as a reference when comparing, not to use them in the code. In the case of the mobile version, it is especially useful to set the width to 375px while in inspect mode.

    🔹The page content could be centered using Grid or Flexbox. For example as follows:

    body {
      min-height: 100vh;
      display: grid;
      place-content: center;
    }
    

    (and you should remove the margins)

    Also, perhaps some of this may interest you:

    HTML 🧱, ACCESSIBILITY ⚖:

    🔹This is a meaningful image and in case the user can't see it, the alt text should give a good description, maybe something like 'Qr code to visit the Frontend Mentor site'.

    CSS 🎨:

    🔹You might want to use some CSS reset, as a good practice at the start of each project. A popular CSS Reset from Josh Comeau 🔎

    For example, these are some very common and useful basic resets:

    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }
    
    picture,
    img,
    svg {
      display: block;
      max-width: 100%;
    }
    

    🔹Length units such as pixels may not be the best alternative because screen sizes and user preferences vary, and absolute units don’t scale. Relative units like em or rem are a better option for scalable layouts (the page will adjust to the user's browser settings) and maintenance (to make changes without having to adjust every pixel value).

    🔹You don't need to use font-weight of 400 and 700 as these are the default values for the normal and bold font respectively. So, these are the default values for paragraphs and headings.

    Please let me know if you disagree with something or if you would like more information on any of these topics.

    If you have any questions I’m here to answer so don't hesitate 🙂

    Regards,

    Marked as helpful
  • P
    Azzumar•340
    @Azzumarithm
    Posted about 2 years ago

    not sure about the image, you might want to check if the path is accurate in the src img attribute and see if the image is in the right directory.

    About the centering, just make the body height : 100vh and then display: flex, justify-content: center (for horizontal center), align-items : center (for vertical centering).

    Marked as helpful

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