Design comparison
Solution retrospective
I am proud of actually taking up the challenge and getting a solution!!! i would be more focused and consistent with my future projects or challenges.
What challenges did you encounter, and how did you overcome them?I encountered issues with actually understanding the challenge although it looked easy I was confused about what exactly I needed, I sorted that out by looking at other submitted solutions and also help from ChatGpt..... I am being honest😂
What specific areas of your project would you like help with?I would need help with my CSS, I don't understand the function of the :root and I need a better way to style that doesn't involve excess code if possible.
Community feedback
- @GMarqzPosted 21 days ago
Hi there!👋 Nice job on completing the challenge!
About your concern with the
:root
pseudo-class...:root
is helpful for declaring global CSS variables. Let’s say you're building a landing page and want to use green across multiple elements. With:root
, you could do something like this::root { --primary-color: green; } .container { background-color: var(--primary-color); } .form-btn { color: var(--primary-color); }
Why is this useful?
In the example above, only two elements use the color for simplicity. But imagine you have ten elements using the same shade of green. If you (or the designer) decide to change the primary color to blue, you won’t need to adjust each element individually. You just change the color in
:root
::root { --primary-color: blue; } .container { background-color: var(--primary-color); } .form-btn { color: var(--primary-color); }
This keeps your code cleaner and easier to maintain. Also, you can use variables for other properties like
font-size
,font-family
, and more! You can read more about global css variables here📗Hope you find this helpful. 😊
Happy coding!
1
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