Design comparison
Solution retrospective
It was a big challenge for me to glue everything together. I improved my use of grids and flexbox, but I'd like to work on more projects to become more confident with these layout methods. I learned how to set up an Eleventy project from scratch. Next time I set up a project differently, there are still some improvements to be made. I was very adventurous and excited to create a solution that saves and loads data from a JSON file. I also tried creating a basic component for the FAQ.
What challenges did you encounter, and how did you overcome them?I learned about accessibility best practices for decorative elements. I also learned more about Sass variables and how to use basic components with JavaScript and Nunjucks.
I encountered trouble with links and CSS url()
for background images. I also had issues with permalinks when deploying my site, but documentation proved to be a valuable resource.
I successfully learned how to import variables in the newest version of Sass. While I initially had problems with links and URLs on the production environment compared to the development server, I was able to troubleshoot and fix the issues.
I've learned to think about solutions and check documentation first before getting overwhelmed. It's important to keep things simple and avoid overengineering solutions.
I'm still confused about when to use rem and em. Have you found any resources with good explanations? I'm not entirely sure if my solution fully meets accessibility standards. Is it a good solution? If you find any mistakes or have suggestions for improvement, please let me know. I will be very grateful.
Community feedback
- @JoramirJrPosted 7 months ago
Hi, Darek!
Your solution looks great!
Regarding em vs rem, from what I can tell, "rem" is very useful when it comes to keeping a consistent set of spacing on all elements; for example, when using such unit to define padding, all of the spacing will have one base unit, the font-size defined at the root/html element level.
"em" is useful if we need localized behavior; for example, if we define a "font-size" using em to an element, let's say a button, its padding, or even margin, when set using the em unit, will be adjusted to the font-size mentioned above; the base font-size is no longer the root, in this base, but the "em" font-size defined in the element itself.
Hope its helpful!
Marked as helpful0@DarekReposPosted 7 months ago@JoramirJr Thanks for your help! I will use rem for Global Sizing and em for Local Sizing.
For the reference i wil be using this for the case similar to the example below or styling responsive button etc.
After setting the base font size at the root (
html { font-size: 100%; }
), set the font size for textual elements to em:h2 { font-size: 2em; } p { font-size: 1em; }
Then set the font-size for modules to rem:
article { font-size: 1.25rem; } aside .module { font-size: .9rem; }
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