Design comparison
Solution retrospective
I can't wait to start the next challenge!
Community feedback
- @correlucasPosted about 2 years ago
👾Hi @sarahwylie, congratulations on your solution!👋 Welcome to the Frontend Mentor Coding Community!
Great solution and a great start! From what I saw you’re on the right track. I’ve few suggestions for you that you can consider adding to your code:
Your solution is great and the code is working, but the HTML structure can be reduced by removing unnecessary divs, all you need is a single
<main>
or<div>
to keep all the content inside, and nothing more. The ideal structure is thediv
and only the image, heading, and paragraph.Here’s one example to show can be cleaner this HTML structure:
<body> <main> <img src="./images/image-qr-code.png" alt="QR Code Frontend Mentor" > <h1>Improve your front-end skills by building projects</h1> <p>Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p> </main> </body>
To reduce the CSS you can use the direct selector for each element instead of using
class
this way you have a code even cleaner, for example, you can select everything using the direct selector for (img, h1, and p, main).Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/qr-code-component-vanilla-cs-js-darklight-mode-nS2aOYYsJR
✌️ I hope this helps you and happy coding!
1@sarahwyliePosted about 2 years ago@correlucas Thanks, Lucas! I tend to overuse html tags, and I know this. I added in the main to remove the landmark warnings, but then never removed the article tags. Good catch!
I chose not to use the direct selector for much of my CSS as I'm used to building out much larger sites. When I start construction, I always assume what I'm building will grow, so I try to stick to class selectors to avoid styling an element unknowingly. That said, I definitely had the little voice telling me to quit doing extra and stick to the direct selectors on this one since it's such a small and simple challenge that is not meant to be broadened. I guess I need to challenge myself to think smaller?
Thanks again, Lucas!
1@correlucasPosted about 2 years ago@sarahwylie To say you the truth, this will change really few doing the css using the direct selector. Was only one advice to keep your code minimal and an exercise.
To say you the truth in my first upload for this solution I have used a lots of div, classes and even
id
to give style to component, in my first day here, someone comment on the solution saying me to think about the component and try to create it with the less div blocks/css possible and this html structure was a result of this exercise.Anyway, your solution was yet perfect this was the only thing I could suggest you =)
Keep it up
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