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

Using Flexbox to create a card with barcode

Dr. Holger Flick•10
@holgerflick
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?
  • I would try to approach this using Grid instead of Flexbox.
  • the task states all measurements in px. In real world, I would most likely flip to rem and em.
What challenges did you encounter, and how did you overcome them?
  • I was uncertain about margin sizes
  • This example made me aware when having a pixel-template that if you calculate the pixels you need to be aware of the box model that padding and margin play a role.
  • I did not do the math to 100% match the pixel sizes of the Figma template
  • Adding the wide space at the bottom - I just eye balled it
What specific areas of your project would you like help with?
  • Figuring out the measurements of the different parts. With Figma I could select different objects in the template. With JPEG, I would use an image tool and look at the size of the different areas. However, is it really necessary to create a representation that is true to the pixel-size. I think as long as it behaves the same considering later tasks will include responsive designs, it does not need to match "by the pixel".
  • I used Chrome on Mac as a browser and the fonts look a bit different than in the Figma template. Do you recommend another browser for comparison? I double checked font weights and colors.
Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • P
    Jan•290
    @Jan-Dev0
    Posted 12 months ago

    Your code is well-structured, but consider using semantic elements like <main> for the main content or a <footer> instead of a <div> to improve accessibility. Additionally, it's good practice to include a global reset and set box-sizing: border-box on all elements to ensure consistent styling across browsers.

  • Mutsa•10
    @mutsamusa
    Posted 12 months ago

    In my opinion pixel-size does matter, esp. if you'd be coding for a client.

    I however must admit I didn't think to actually calculate the design file's sizes and also pretty much eye-balled spaces and pxs.

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