@correlucas
Posted
๐พ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 the div
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!
@sarahwylie
Posted
@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!
@correlucas
Posted
@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