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

Desktop Design QR Code

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

Solution retrospective


Is there any feedback you can give me? How do you get the right font, I feel like the font does not look right? I'm still a little bit unsure about how vh works when it comes to sizing? Should I use vw when sizing the width? What challenge would you recommend next?

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Daniel 🛸•44,830
    @danielmrz-dev
    Posted over 1 year ago

    Hey, @originalboss!

    Congrats on your first project! It looks nice!

    Here's my feedback about your project:

    • You can place your card in the middle of the page by doing this:
    body {
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;    
    }
    

    Also, in order to work correctly the font needs to be imported from Google Fonts. You can paste this on top of your CSS file:

    @import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100;200;300;400;500;600;700;800;900&display=swap');
    

    I hope it helps!

    Other than that, great job!

    Marked as helpful
  • dselimovic02•220
    @dselimovic02
    Posted over 1 year ago

    vh and vw are abbreviations for viewport height and width which are units just like px(pixel). 1vh = 1% of your viewport height meaning if your vh is, for example, 100px, 1vh would be 1%. viewport is size of screen displaying the content. You can founf out more about units ini this w3schools lecture: https://www.w3schools.com/cssref/css_units.php

    Cheers!

    Marked as helpful
  • P
    Øystein Håberg•13,280
    @Islandstone89
    Posted over 1 year ago

    Hey, let's take a look at how we can improve this.

    HTML:

    • You need a <main>, this is important for accessibility. I would slightly simplify the structure: Remove the container div, and change .card into a <main>.

    • The image must have alt text. This is essential for screen readers to understand the image. The alt text should be descriptive, and in this example, it also needs to say where it leads (frontendmentor.io).

    • Headings should always be in order, so you never start with a <h3>. Change it into a <h1>.

    • Never use <br> to force a new text line. The text should flow naturally. If you want to limit the width of the text, you can use inline-padding in the CSS.

    CSS:

    • It's good practice to include a CSS Reset at the top.

    • Remove max-width on body.

    • I wouldn't use Grid here, so remove display: grid.

    • You are not using the correct font, no. You need to select it on Google Fonts, copy the code, and paste it into the <head> of the HTML.

    • It's not common to use viewport units for widths. Remove the width and height on the card. You can use viewport units for heights, as you will see shortly.

    • To center the card horizontally and vertically, use Flexbox on the body:

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    
    • Hence, you can remove margin: auto.

    • Remove width on the image. Add display: block and max-width: 100%, to prevent it from overflowing its container.

    • Remove margin on the image. To get space between the image and the edge of the card, use padding on the card itself.

    • Font-size must never be in px. Use rem instead.

    • Add a max-width of around 20rem on the card. This is to prevent it from getting too big on larger screens.

    • Since all the text should be center-aligned, you only need to set text-align: center on the body: Remove it elsewhere.

    As for what challenge to do next, check out this post by Grace Snow, one of the leading contributors here on Frontend Mentor.

    Good luck :)

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

Oops! 😬

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

Log in with GitHub