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

Design Qr code component using css flexbox

Abbas Roholamin•30
@abbas-roholamin
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Is it recommended to use width properties for responsive design?

Code
Couldn’t fetch repository

Please log in to post a comment

Log in with GitHub

Community feedback

  • Lucas 👾•104,160
    @correlucas
    Posted almost 3 years ago

    👾Hello Abbas Roholamin, congratulations for your first solution and 😎 welcome to the Frontend Mentor Coding Community!

    Answering your question:

    To make this container responsive you need to use max-width: 320px to allow it to contract, and never use width if you want an element behaving responsive.Note that the difference between these two properties is that width is fixed, example, width: 320px is an container that doesn't get bigger or smaller than 320px but max-width: 320px have the maximum of 320px and can contract when the screen scales down and adjust its size.

    If you’re not familiar to media queries and responsivity, here’s a good resource to learn it: https://www.w3schools.com/css/css_rwd_mediaqueries.asp

    👋 I hope this helps you and happy coding!

    Marked as helpful
  • Dorian Edwards•110
    @dorian-edwards
    Posted almost 3 years ago

    tldr:

    1. set a width 95-100% and then a max-width of your choosing to make a block level element automatically responsive
    2. Using relative size units e.g. rem, allows you to change one property and resize your whole site.

    To answer your question, it is, and in time you'll pick up a few handy tricks that make life easier. For example setting something with a width of 100% and a max-width of say 600px will ensure that as the screen shrinks it will fill up the width of the screen up to a point. When it reaches it's max size, say on a desktop, it will max out at 600px rather than stretching the length of the screen.

    Another trick I've seen used is to use rem as units for sizing. These units are tied to the root pixel size. So if your root element size is 16px (the default for a lot of browsers) then 1rem = 16 pixels. Some folks set their root to 10px directly or 62.5% -- 10px after calculating from the standard root of 16 -- to work units based on 10 instead of 16. The point of this is that on smaller screens you can change the root pixel size and everything else on your page will be resized automagically. This isn't really width related but still, it'll help with responsive design.

    Marked as helpful
  • PhoenixDev22•16,830
    @PhoenixDev22
    Posted almost 3 years ago

    Hi Abbas Roholamin,

    • In my opinion, the image is an important content. The alternate text should indicate where the Qr code navigate the user: like QR code to frontend mentor not describes the image
    • There are so many arguments against setting the root font-size: 62%it state that you should never change the root font size because it harms accessibility.

    It's better to :

    • Rely on default browser font sizes instead of setting it on the :root, <html> or <body>.
    • Use rem units to help scale content with a user’s personal preferences.

    Last , It's a good practice to have the styles in separate file he reason for this is that the CSS stylesheet exists for the purpose of defining the presentation style of the document. The HTML file exists to define the structure and content of the document also it's useful If multiple pages on your site have the same look and feel.

    Hopefully this feedback helps

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

Oops! 😬

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

Log in with GitHub