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

A QR Code Component using HTML, CSS and Flexbox

Wesley•330
@wesleyjacoby
A solution to the QR code component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


I mostly seem to struggle with resizing images. I've used the max-width property on the QR Code image, but should I have used the width and height properties instead? Does max-width and min-width have to do with responsiveness? The difference between these properties is something I need to research further.

Mostly, I'm relatively pleased with the result.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

  • Bright Adigwe•190
    @Femi-Bright
    Posted almost 3 years ago

    Hi Wesley, Lucas has already given a comprehensive explanation on max-width/min-width. Let me just add this.

    img {width: 500px;} You are telling the browser that "Hey! come rain, come sunshine, I always want this image to always be 500px even if the viewport width is 320px IDC"

    img {max-width: 500px;} You are telling the browser that "Hey! if there's enough space to make this image 500px fine! else feel free to scale it down as the viewport decreases. I just want it to have a maximum width of 500px"

    img {min-width: 500px;} You are telling the browser that "This should be the minimum width for this image at any viewport but feel free to scale it up if need arises"

    Nice, attempt btw

    Marked as helpful
  • Kyle•50
    @CaptainKaveman
    Posted almost 3 years ago

    Hey Wesley,

    You've already got great answers about image widths, I would like to just add a helpful resource for creating websites that are responsive. Check out Kevin Powell, he has a free course called Creating Responsive Layouts and he goes into detail on explaining how to have various elements resize themselves depending on the view port size. I typically will have all images set to max-width: 100% by default. This will shrink the images that are to large and overflow to fit the container they are in. I also like to use a percentage for the width and then I will set a pixel value for my max-width. That way on large screens it won't stretch too much.

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

    Hello Wesley! Welcome to Frontemd Mentor community and congratulations for your first challenge!

    Answering your question about width and max-width. Max-width/min-width has to do with responsiveness because isn't a fixed value property, for example a container with width 600px is fixed, doesn't get bigger or smaller, but the same container with max-width: 600px can stretch when the page width gets under 600px.

    So these properties are a good fit if your purposes is something flexible.

    I hope this make more clear this idea about max-width and width differences.

    Congratulations bro!

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