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

QR Code Component using simple CSS

Isaac Vono•40
@Zzzackk
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Well, this is my first project and I had some difficulties during it but I think it is because I tought too much about simple things and made them way harder or complex than they should be, overall I think it looks decent. If you have any tips or feedback about the project I would love to hear them so that I can continue practicing and doing other projects. 👍

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • PhoenixDev22•16,830
    @PhoenixDev22
    Posted almost 3 years ago

    Hi Isaac Vono,

    Congratulation on completing this frontend mentor challenge. Your solution looks great. I have some suggestions regarding your solution:

    • In my opinion, the image is an important content. The alternate text is needed on this image. The alternate text should indicate where the Qr code navigate the user : like QR code to frontend mentor not describes the image. The alternate text should not be hyphenated, it should be human readable.
    • Add min-height: 100vh to the body that let the body grows taller if the content outgrows the visible page instead.
    • width: 256px; an explicit width is not a good way to have responsive layout . Consider using max-width to the card in rem .

    • Adding max-width on the body tag to prevent layout from stretching. If you try to zoom out on your browser , you'll see that the layout stretches, adding max-width will prevent that. Personally, I don’t restrict the width or height of the body element. If I need to restrict the width I use a container div with a max-width on it.

    • Remember a css reset on every project. That will do things like set the images to display block and make all browsers display elements the same.

    Overall, Excellent work! Hopefully this feedback helps.

    Marked as helpful
  • Ahmed Kamel•1,190
    @hmadamk
    Posted almost 3 years ago

    first of all you should never use fixed height unless really neccessary, so to center your main card you should use body{ min-height:100vh } and you don't need to add the width on the body secondly you should import the font from google fonts the link is on the readme you check the rquired weights and add the generated link on the top of your html code; lastly to control your text width you should use the ch unit wich is the width of the number zero like that p{ width:32ch }

    Marked as helpful
  • Sathya D•310
    @satzzzzz07
    Posted almost 3 years ago

    Hey there, Great work on your first solution! Design looks good. There are few suggestions:

    1. Try to use the fonts mentioned in the style-guide file. You can import the fonts from google fonts(https://fonts.google.com/). Its a simple process, choose the font, size and then import them into your css or html files. You can use the font style using font-family css property.

    2. Centering the Element - For Centering the element in the page you can wrap the element in a div. and use flexbox more about flexbox.

    Aside these, excellent work again and happy coding :) 👍

    Marked as helpful
  • David•7,960
    @DavidMorgade
    Posted almost 3 years ago

    Hey Isaac, congrats on finishing the challenge and welcome to the community, you did a pretty good job for a first challenge!

    It seems that you had some trouble centering your component, I would recommend you to remove the fixed width and height from your body cause that is causing some strange behaviour on your layout.

    Apart from that, since you already have display: grid on your body, you just need to use the property place-content: center (this will center your item inside the grid to the center), and also set the body height to the full screen with height: 100vh;.

    With just this 2 properties and removing the fixed width and height, you should get your component on the middle of the screen!

    Hope my feedback helps you, if you have any questions, don't hesitate to ask!

    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 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

Oops! 😬

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

Log in with GitHub