Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 12 months ago

Finished QR code component

Tahsin YT•270
@Randomgituser69
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?

Proud of making it similar to what it looks in the picture of the design. Though I'd apologize for the photo not loading for some reason. Idk why it didn't it load. Btw not sure what would i do differently next time

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

I was struggling with putting the card to the center but when i set the display to grid,place content, place items to center then it's fixed

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

Guys how can i fix html img not showing on GitHub repository? Adding ./images/ to the href didn't even work. How do i fix it please please? I've never been so angry over this

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Grace•32,130
    @grace-snow
    Posted 11 months ago

    Here is some foundational feedback to help you. Note you will need to refactor all projects with some of these things.

    1. All content should be contained within landmarks. This needs a main wrapping the component, and a footer for the attribution.
    2. You don't need to use the picture element in this. The picture element is used when you want to serve different images at different screen sizes. This only has one image. When you do need to use the picture element in future, you would make the mobile image the default inside the img element and you would use a min-width media query in the source tag (media query defined in rem or em not px) to serve the larger screen image.
    3. The Imogen this is extremely important content. That means it needs a proper description. In this case the alt should say what the image is (QR code) and where it goes to (two frontendMentor.io).
    4. There should be no hgroup in this.
    5. You don't actually need an extra div to wrap the image or the text. It's no problem having it in there but as a general rule keep the HTML as simple as possible.
    6. Remove the br from the heading. That is not how you create line brakes. Some screen readers will announce this as "break" in the middle of the heading, which is not what you want. Instead let the lines break naturally. In some cases in certain challenges if you need lines to break earlier you would give the element a max width rem or ch units, and margin-inline auto if that limited width element also needs horizontal centering.
    7. Never set font-size in px. Use rem.
    8. Get into the habit of always including a full modern CSS reset at the start of your styles. Andy Bell or Josh Comeau both have good ones you can look up and use.
    9. It's better for performance to link fonts in the HTML head instead of CSS imports.
    10. Recommend use the flex column method to centre components like this in the viewport and not the grid place-content center method. This will prevent overflow people viewing a site on smaller screens who have a larger size. It's a more robust method.
    11. There should be no widths or heights in this challenge. All the card needs is a single max width in rem.
    12. The image must not have a width pixels. All it needs is what is included in a CSS reset anyway (Display block and Max width 100%).
    13. There is no benefit to using grid on this card. All it needs is a text align center. The only benefit using grid or flex on this card would be if you wanted to use the gap property instead of margin to create vertical spaces. But really that's unnecessary.
    14. The image doesn't need small padding and margins. Let the image be Full size. Can optionally have a margin bottom. But as you've already given margin top to the H2 even that is unnecessary.
    15. Your card is actually off centre at the moment. This is because the footer (attribution) is wider than the card and the card sits to the left inside it's grid area. If you use the flex column approach to center your component as I suggest above this would be solved.
  • Natércio•30
    @Natercio8
    Posted 12 months ago

    Does the layout look good on a range of screen sizes?

  • gonzzdev•70
    @gonzzdev
    Posted 12 months ago

    Hey there!

    Here are some steps on how to import your image.

    • Go to your GitHub repo (https://github.com/Randomgituser69/Qr-code-component-)
    • Click on add file and drag the file to your repository.
    • Edit your index.html file to add image using:
    <img src="image-name.png" />
    

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.

Frontend Mentor for Teams

Frontend Mentor for Teams helps companies and schools onboard and train developers through project-based learning. Our industry-standard projects give developers hands-on experience tackling real coding problems, helping them master their craft.

If you work in a company or are a student in a coding school, feel free to share Frontend Mentor for Teams with your manager or instructor, as they may use it to help with your coding education.

Learn more

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