Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

QR Code Component using Flexbox

@maliabadziukh

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


I used background-image property to insert the QR code image and style it. Is that a good practice? What would be a better approach?

Community feedback

Bryan Li 3,530

@Zy8712

Posted

Your site looks pretty good. To answer your question, I personally think its better for you to use a regular <img> tag to insert the QR code. The reason being that the QR code is apart of the page's main content so it should be inserted using the img tag, whereas background-image is usually used for things that are not apart of the page's main content.

Additionally, when you use an <img> tag it allows you to use an "alt" attribute to describe your image. This may be useful when the image fails to load, and the alt text appears to let users know that something failed to load. Also, the "alt" text can be detected by screen readers, whereas background-image can't be detected. So its important for accessibility purposes.

Marked as helpful

1

@maliabadziukh

Posted

@Zy8712 Thanks for your feedback! I had a feeling it would be bad for SEO/ accessibility but wanted to check anyway. Updated my solution!

0
mihai2537 190

@mihai3636

Posted

Hello!

I'm not entirely sure if that is a good practice or not, but I could share a piece of advice that I just received as well.

I noticed that you used "height: 100vh" there. That is going to cause problems if you zoom by ctrl + "+". (go more than 150% and your content will be cropped)

The reason is this: when you zoom, the size of everything else changes, but the size of your container will stay constant at whatever 100vh is. (This happens because your viewport has the same height whether you zoom or not. So 100vh will be the translated to the same value in pixels before and after the zoom)

If the size of everything else increases but the container's height is the same, it leads to overflow and that's why you see the component appear as cropped.

The solution is to use min-height: 100vh;

Also, congrats for your submission! The card looks neat!

I hope I was clear enough and please take what I said with a grain of salt and do your own research as what I just told you is my own interpretation of my own research and I do not claim to be 100% right.

Marked as helpful

1

@maliabadziukh

Posted

@mihaidogaru2537 Thanks a lot for your feedback, it was very clear and helpful! I implemented your suggestion and tested the differences, works perfectly! :)

1

Please log in to post a comment

Log in with GitHub
Discord logo

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