QR code component w/ Pure CSS & Mobile-First Approach
Design comparison
Solution retrospective
I tried Mobile-First approach with pure CSS using media queries without using classes. So I could practice my CSS selector skills. Tried to do it quickly so, it wasn't that clean. (Took me 1.5 - 2 hrs)
Any suggestion, comments, criticism for a better approach in this website? (I would really appreciate it ^_^ )
Community feedback
- @MelvinAguilarPosted almost 2 years ago
Hello there π. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
Alt text π·:
- The
alt
attribute should not contain underscores or hyphens, it must be human readable and understandable.
- The
alt
attribute should not contain the words "image", "photo", or "picture", because the image tag already conveys that information.
-
The
alt
attribute should explain the purpose of the image. Uppon scanning the QR code, the user will be redirected to the frontendmentor.io website, so a betteralt
attribute would beQR code to frontendmentor.io
If you want to learn more about the
alt
attribute, you can read this article. π.
CSS π¨:
- Setting the width of the component with a percentage or a viewport unit will behave strangely on mobile devices or large screens. You should use a max-width of
320px
or20rem
to make sure that the component will have a maximum width of320px
on any device, also remove thewidth
property with a percentage value.
- A tip, instead of using flexbox and having width: 87% to center the image you could use padding on the component, this way you would create the space between the image and the component border and not repeat so much code. To give you an idea, the challenge does not require any media query, it can be made responsive for all devices just by using the necessary styles.
main > section { /* padding: 1rem 0rem; */ background-color: var(--white); /* width: 85vw; */ padding: 1rem; max-width: 318px; text-align: center; } div img { width: 100%; /* max-width: 87.5%; */ }
I hope you find it useful! π Above all, the solution you submitted is great!
Happy coding!
Marked as helpful1@Iron-MarkPosted almost 2 years ago@MelvinAguilar Thank you! I really appreciate your effort in making this feedback! π
0 - The
- @AhmedMahroussPosted almost 2 years ago
good jop my bro Congrats on completing your challenge!ππ»If you have any questions or need further clarification, feel free to reach out to me. Happy Coding! ππ
0@Iron-MarkPosted almost 2 years ago@amahrous176 Thanks, bro! If you could give some suggestions about how it was done, I'd really appreciate it.
0
Please log in to post a comment
Log in with GitHubJoin 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