Skip to content
  • Learning paths
  • Challenges
  • Solutions
  • Articles
  • 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,200
    @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

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