
Solution retrospective
First frontend challenge! Next time I might try Tailwind CSS instead of plain CSS.
What challenges did you encounter, and how did you overcome them?The biggest challenge was the width of boxes. Noticed in the figma design files, only qrcode had a fixed size. All other boxes are adjusted automatically based on the qrcode.
I guess the key is to set the .container
(or .card
)'s width: min-content
. And set children's width: 100%
. Then it seems alright.
How to code it more elegantly?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @jvssvj
Hello friend, congratulations on completing the challenge 👏. I'll give you some tips, starting with HTML.
📌 I saw that you placed a
main
tag, and then adiv
with thecontainer
class, this div is not necessary, because in this case themain
tag would already be thecontainer
.📌 In your
text
class we can place a section, as it contains a main title.💡 Use BEM in your projects. Read more here: BEM
Your Fixed HTML:
<main class="container"> <img src="images/image-qr-code.png" alt="QR Code image."> <section class="text"> <h1 class="text-preset-1">Improve your front-end skills by building projects</h1> <p class="text-preset-2">Scan the QR code to visit Frontend Mentor and take your coding skills to the next level</p> </section> </main>
📌 If the component needs to shrink according to the screen size, do not use fixed widths, this way you avoid some unnecessary styles. for example: width: 320px, opt for:
.component { width: 100%; /*To occupy 100% of the available size*/ max-width: 320px; /*adjust as needed*/ }
Marked as helpful - @ROKUROO7
Hello there, Good Job on Completing the challenge.
As i am pretty new to web development, just started a few weeks ago. So i can’t really provide much of an insight on the other hand i really learned a lot from reading your code such as using min-content as width.
Thanks.
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