
Solution retrospective
I am proud of the following aspects of my project:
— Utilizing CSS variables for color management, ensuring consistency and scalability.
— Exclusively using REM units for responsive typography and layout.
— Effectively positioning elements to achieve a clean and organized structure. — Faithfully replicating the original design with close attention to detail.
— Using only class selectors in CSS, resulting in a clean, consistent, and maintainable codebase.
What challenges did you encounter, and how did you overcome them?I encountered a challenge with centering the box but resolved it by setting the height to 100vh.
Aside from that, all other elements were implemented smoothly.
What specific areas of your project would you like help with?I would appreciate feedback on the following areas of my project:
— Is my approach to centering elements using height: 100vh the most efficient, or are there better alternatives?
— Are there any improvements I could make to my use of CSS variables and class selectors to enhance maintainability or scalability?
— Does the code follow best practices for responsive design, especially with the exclusive use of REM units?
— Are there any areas where my positioning or layout could be optimized for better readability or accessibility?
Specific insights or suggestions on these aspects would be highly valuable.
Please log in to post a comment
Log in with GitHubCommunity feedback
- @skyv26
Hi @ExtendoGH, 😊
I reviewed your project, and I must say you've done a commendable job! Here's a detailed breakdown of your code, along with some suggestions to improve it even further.
1. Simplifying CSS Spacing with Flexbox
Your current approach to using
margin-bottom
repeatedly for spacing works but can become hard to maintain as the project scales. Instead, leveragingdisplay: flex
on the container withgap
is a more scalable and efficient solution.An Example:
Imagine you’re organizing books on a shelf. Instead of leaving varying gaps manually between each book, you could use dividers that maintain consistent spacing.Refactor Suggestion:
/* Current Code */ .qr-img { width: 100%; border-radius: 10px; margin-bottom: 2.4rem; } .qr-heading { color: var(--slate-900); font-size: 2.2rem; font-weight: bold; line-height: 120%; margin-bottom: 1.6rem; } /* Refactored Code */ .qr-container { display: flex; flex-direction: column; gap: 1.6rem; /* Controls spacing between child elements */ background-color: var(--white); border-radius: 20px; max-width: 32rem; padding: 1.6rem; filter: drop-shadow(0px 25px 25px rgba(0, 0, 0, 0.0477)); }
Benefits:
- Reduced CSS redundancy.
- Dynamically adjusts spacing if new content is added.
- Cleaner and more maintainable code.
2. Meaningful Comments in CSS
While your current comments are organized, they could be more descriptive to help other developers understand the intent behind specific styles. Avoid shorthand like "OUTFIT BOLD: FZ: 22px" and opt for explanations.
Why this matters:
Think of a recipe. Instead of writing "use 1 tsp," specifying "use 1 tsp of salt to enhance flavor" makes it easier for someone following the instructions.Refactor Suggestion:
/* Current Comment */ --02--TYPOGRAPHY - OUTFIT BOLD: FZ: 22px, LH: 120%, LS: 0px /* Refactored Comment */ -- Typography - Use Outfit Bold font for headings, ensuring readability with a font size of 22px, line height of 120%, and letter spacing of 0px.
3. Optional but Handy: Avoiding Repetition in Styles
Your solution to center cards with
height: 100vh
is excellent! While position-based centering (position: absolute; transform
) works too, your method is simpler and easier to maintain. Great job! 👏Example of Position-Based Centering (not necessary here):
.qr-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
But your approach is better for this use case—cleaner and beginner-friendly.
Final Note
You're off to a great start! Keep experimenting with semantic HTML, flexible layouts, and concise commenting to make your code even more robust and future-proof. 🚀
Feel free to reach out for further discussions or feedback. Happy coding! 😊
Marked as helpful - @lion9
Well done!
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