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

QR Code Component

Nishant Parashar•70
@nishaanntt
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?

learnt to use css and media queries

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

media queries

What specific areas of your project would you like help with?

css

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Account deletedPosted over 1 year ago

    Hello, Nishant. Good work on the challenge!

    I prefer you use the * selector to reset the margins and padding, and include the box-sizing of all elements.

    * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    }
    

    You would have to adjust the margin and padding to the content if you do this.

    I also want to suggest another way to center your content.

    In your CSS:

    • You can use the body selector to center the content like you did with the wrapper.
    body {
    height: 100vh; /* or 100% */
    display: flex;
    justify-content: center;
    align-items: center;
    }
    

    _ _ _ OR _ _ _

    Inside your main content selector:

    .card {
    position: absolute; /* or relative */
    top: 50%;
    bottom: 50%;
    transform: translate(-50%, -50%);
    /* your styles */
    }
    

    You can use either of these centering methods if you wish. Otherwise, keep it up!

    Marked as helpful
  • P
    Sagi•150
    @ratsagi
    Posted over 1 year ago

    Greetings, Nishant!

    Good job on completing the challenge!

    I have some suggestions for you to improve your solution:

    1. Use figma file if it is possible because it gives you more details about the design. If you use figma file that's provided on this challenge you will see that the paragraph with the class of mainText on the line 19 is actually is the heading.
    2. Take a look on the accessibility best practises.Try to use html semantic tags instead of div because it gives more meaning for your project. Keep away from absolute units like pixel instead use relative units. You have forgotten to add alt text for your image. here you can read more about it
    3. According to the responsivenes of the page. There is no need to use media-query here. Let browser to decide. Also when you used width property with the value of vw like this width: 19vw in class of card to limit the size of the component is bad idea because it is hard to read content inside when the size of the screen gets smaller. Instead I suggest to use max-width property with the relative unit like rem or em.
    4. In the class of card it is not necessary to use flexbox because h1 and p tags are block level element which starts in new line automatically.
    5. I suggest also css custom properties which gives you more flexibility for your code. It allows you quikly make changes without efforts.

    Hope you find this helpful.

    Happy coding!

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

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