Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 3 years ago

QR code components using semantic html and css styling

Ngbea Gloria James•30
@NgbeaGloriaJames
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


All feedback is welcome especially on the layout and mobile responsiveness work

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • imad•3,330
    @imadvv
    Posted almost 3 years ago

    Greeting Ngbe Gloria James!! Congratulations for completing your challenge!, 👏👏👏 well done.

    you did great work on this one, You've done a really good work in your first solution!, and for you question, I saw that you're using margin: 100px auto; on card to center it on the middle of the page, which work's, however they're an alternative ways to do so, you can use either grid or flex to have a full control over the layout, and you can easily manipulate on different screen sizes.

    for example using grid, you can start using the body as a reference to control the layout, you start by give it a min-height:100vh to fill the browser screen size, and display it as a grid system, display: grid; and place-content: center; to center content perfectly on the middle of the page no matter what, from there you can safely remove margin: 100px auto; from the card,

    body {
    min-height: 100vh;
    display: grid;
    place-content: center;
    
    }
    
    .card {
    	
    	/* margin: 100px auto; */
    	
    }
    

    if you apply this changes, you will notice that they're no different, but if you open the DevTools, and go to the body, you will see a grid system, that you can apply different proprieties to it, and you can easily control the layout on more robust way on different screen sizes.

    useful resource:

    • https://web.dev/learn/css/grid/
    • https://css-tricks.com/a-complete-guide-to-css-media-queries/
    • https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids

    Hope this help!

    overall you did Great work matching the design, Happy Codding, and Keep up the Good Work

    Marked as helpful
  • Elaine•11,360
    @elaineleung
    Posted almost 3 years ago

    Hi Ngbe Gloria, welcome to Frontend Mentor, and well done in completing your first challenge! You did a number of things well here, such as not setting a fixed pixel width on the image, and also in making the solution close to the design. You just need to add the Google Font in the style guide; instead of pasting the link in the style guide, you'll have to visit the link and select the font faces you need (as in the font weights), then copy the link provided and paste it back into the head tag.

    About your question, I just got two suggestions here:

    1. I see you using margins to making the component centered; what you can try instead is to add this to the body selector:

      body {
         display: grid;
         place-content: center;
         min-height: 100vh;
      }
      
    2. To make the card more responsive, change width:300px to max-width: 350px on the container and change the margins to margin: 1rem just so there's some space around the card on smaller screen sizes. You can experiment with the max width value to see how close you can get to make it match the design.

    Try resizing the browser and the card should be responsive!

    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

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