Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted about 2 years ago

QR Code component using Flexbox

P
Chad Elofson•50
@chadelofson
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 am in the learning path, no changes have been made

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

base layout was challenging at the time and I found that I could make the body a flexbox

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

At this point none. I think I got all of the feedback I needed

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • _nehal💎•6,710
    @NehalSahu8055
    Posted about 2 years ago

    Hello Coder 👋.

    Congratulations on successfully completing the challenge! 🎉

    Few suggestions regarding design.

    • Remove margins from <main> as it will not dynamically center the card.

    • To properly center the card

    • USING FLEXBOX

    body{
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    }
    
    • Every site must have one h1 element describing the main content of the page.

    • So, Add a level-one heading instead of h3 to improve accessibility.

    • <h1>Improve you frontend skills by building projects</h1>

    • Use Semantics for the proper design of your code.

    <body>
    <main>...</main>
    <footer>...</footer>
    wrap up `.attribtution` div inside your footer.
    </body>
    
    • For non-decorative images give meaningful and descriptive alt like alt= "QR code to frontend mentor website".

    • Use responsive units(rem, em, %) from next project. Explore respective use cases on google.

    • Replace width with max-width to make your card more responsive.

    link.

    I hope you find this helpful.

    Happy coding😄

    Marked as helpful
  • samaelWebDev•240
    @samaelwebdev
    Posted about 2 years ago

    When it comes to laying out HTML elements on a website, you have two excellent options: CSS flexbox and CSS grid. Both are powerful tools that offer different approaches to layout, and they are both great choices. Let me explain why, including the benefits of responsiveness.

    CSS Flexbox:

    Flexible one-dimensional layout: Flexbox is designed for one-dimensional layouts, making it perfect for arranging elements horizontally or vertically. It provides a simple and intuitive way to control the positioning, alignment, and order of elements within a container. Easy to understand and use: Flexbox has a straightforward syntax, making it relatively easy to grasp and implement. You can define a flex container with display: flex and apply various properties like justify-content and align-items to control how elements are distributed and aligned. This simplicity makes it an excellent choice for beginners. Responsive by default: Flexbox automatically adjusts the size and position of elements based on the available space. This inherent responsiveness means that elements can adapt to different screen sizes and orientations without requiring complex media queries. It saves time and simplifies the process of creating responsive designs.

    CSS Grid:

    Two-dimensional grid layout: CSS grid provides a powerful system for creating two-dimensional layouts. It allows you to define rows and columns and place elements within grid cells, providing precise control over the positioning and alignment of elements. Complex and versatile layouts: Grid is particularly useful when creating complex layouts with multiple elements. It enables you to define the explicit structure of rows and columns, control the spacing between cells, and even overlap elements if needed. This versatility makes it a great choice for building grid-based designs like image galleries or magazine layouts. Responsive design control: CSS grid provides powerful responsiveness features. By combining grid properties with media queries, you can modify the grid structure, change the placement of elements, and control the sizing and spacing at different breakpoints. This allows you to create adaptive layouts that adjust seamlessly to various screen sizes and devices.

    In summary, both CSS flexbox and CSS grid are fantastic options for laying out HTML elements on a website. Flexbox is ideal for simple one-dimensional layouts and offers inherent responsiveness. Grid, on the other hand, excels in creating complex, two-dimensional layouts and provides fine-grained control over positioning. Both systems can be combined and leveraged based on the specific needs of your project, ensuring that your layout is not only visually appealing but also responsive and adaptable to different devices and screen sizes.

    I will provide you with links to both W3Schools and MDN Web Docs, which will show you exactly how CSS flexbox and grid work. Additionally, I will share links to guides on using them in case you prefer practical instructions instead of reading all the theory, although I suggest you do so regardless. I also recommend bookmarking the provided website and saving them in a folder for future reference. I hope this assistance proves helpful, my friend. Good luck and happy coding!

    GRID LINKS:

    CSS Grid W3Schools link - https://www.w3schools.com/css/css_grid.asp

    CSS Grid MDN Web Docs link - https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout

    CSS Grid Guide - https://grid.malven.co/

    FLEXBOX LINKS:

    CSS Flexbox W3Schools link - https://www.w3schools.com/csS/css3_flexbox.asp

    CSS Flexbox MDN Web Docs link - https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox

    CSS Flexbox Guide - https://flexbox.malven.co/

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