Responsive QR code card component using flexbox
Design comparison
Solution retrospective
feedback welcome in advance
Community feedback
- @MelvinAguilarPosted about 2 years ago
Hi @tehseen01 👋, good job completing this challenge, and welcome to the Frontend Mentor Community! 🎉
Here are some suggestions you might consider:
- It's recommended to use the semantic tag main. Click here for more information.:
With semantic tags:
<body> <main> <article class="container"> . . . </article> </main> <body>
- Centering the element with position would make your element behave strangely on some mobile devices. There are two modern CSS techniques to center elements instead of using the position property:
Using flexbox layout:
body { width: 100%; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; }
Using grid layout:
body { width: 100%; min-height: 100vh; display: grid; place-content: center; }
Links with more information:
- The Complete Guide to Centering in CSS.
- A Complete Guide to Flexbox (CSS-Tricks).
- How TO - Center Elements Vertically (W3Schools).
- CSS Layout - Horizontal & Vertical Align (W3Schools).
.
- Instead of using pixels in font size, use relative units of measure like
rem
orem
. The font size in absolute length units (px) does not allow users with limited vision to change the text size in some browsers. Reference.
I hope those tips will help you.
Good job, and happy coding!
Marked as helpful1 - @vanzasetiaPosted about 2 years ago
Hi there! 👋
Congratulations on completing your first Frontend Mentor challenge! 🎉
Here are some suggestions for improvements.
- The alternative text of the QR code should not be hyphenated (like code).
- Also, it should not contain the word "image". The semantic meaning of the
img
element is already enough. - I recommend taking a look at "Quick tip: Using alt text properly - The A11Y Project".
- Use the
body
element as the main element or the page for the website. So, there's no need to style thehtml
element. - It's best to not style
html
element because it can overwrite the user's setting. - Currently, only the
body
element hasbox-sizing: border-box
. If you want to make all elements have that behavior, use a universal selector instead. - To place the card in the center of the page, I recommend using flexbox or grid. These modern techniques are more robust than absolute positioning and require less code to implement.
I have three recommended videos. The first one tells how hard HTML is (HTML is not easy). The other two talk about modern CSS techniques and approaches.
- Manuel Matuzović - Lost in Translation - YouTube
- Andy Bell – Be the browser’s mentor, not its micromanager - YouTube
- Stephanie Eeckles - Scaling CSS Layout Beyond Pixels - YouTube
I hope this helps! Happy coding!
Marked as helpful0
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