Design comparison
Solution retrospective
Hello everyone π It's my first challenge on this site, i want to know if there's a more better way to code this project, on the HTML and CSS file.
Thank you
Community feedback
- @correlucasPosted about 2 years ago
πΎHello Kusuma-io, Congratulations on completing this challenge!
I saw your solution preview site and I think it's already really good. Hereβs some tips for you to improve it:
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 Image" > <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 more cleaner, for example, you can select everything using the direct selector for (img, h1, and p, main).βοΈ I hope this helps you and happy coding!
Marked as helpful1@Kusuma-ioPosted about 2 years ago@correlucas Thank you so much for the suggestion! the example really help me to understand, will keep it in mind :)))))
1 - @vanzasetiaPosted about 2 years ago
Hi there! π
Congratulations on completing your first Frontend Mentor challenge! π It's great that you write a good alternative text for the QR code! π
Here are some suggestions for improvements.
- I recommend simplifying the HTML markup. For example, you can use the
main
element as the main wrapper for the card. For your information, it is possible to finish this challenge without using a singlediv
element. - Attribution is not the main content of the site. So, it should live in another landmark element which is
footer
. - I recommend adding
rel="noopener"
to any anchor tags that havetarget="_blank"
. It helps protect users of legacy browsers. I suggest reading the web.dev article to learn more about this. - I suggest adding some
padding
on thebody
element to prevent the card from touching the edges of the browser.
I hope this helps! Keep up the good work! π
Marked as helpful1@Kusuma-ioPosted about 2 years ago@vanzasetia thank you so much!, it's actually very helpful, this suggestions is something that i didnt even think of :').
Also another thing, you said that it's possible to finish it without using div element, but if I think that I wanna use this QR card multiple times somewhere else, it's much more easier to put it in a div element, right ?
0@vanzasetiaPosted about 2 years ago@Kusuma-io
Happy to hear that was helpful! π
For me, if it is going to be a reusable component then I would only have one
div
as the card component. It's hard to give suggestions since it is a small challenge.So, for the QR code challenge, I recommend removing all
div
since it is not needed.But, there's a challenge where the card is reusable. It is the 3-column preview card component. So, for this challenge, you can have three
div
with thecard
class that have the same styling. This is a good challenge if you want to practice creating reusable card components. π0 - I recommend simplifying the HTML markup. For example, you can use the
- @marcotracercvPosted about 2 years ago
HI!! nice one!! even on something simple is important to practice and implement good practices on coding. Try using the following to improve your code habilities: 1.- use css variables for future maintenance, changes or complex projects, variables help you to avoid issues on styling and improve reusable and scalable code. 2.- use a css methodology, css has to be readable, reusable and scalable. those are basicly guidelines of how to write better css code, well structured, better names and coherent. 3.- use a preprocessor, those are basicly css with superpowers!!... basicly helps you writing code faster, avoid redundancy, integrate options like modularize, tools and functions which makes easier and conftable writing code.
have a nice coding day!!
Marked as helpful0@Kusuma-ioPosted about 2 years ago@marcotracercv Hi, thank you for the suggestion! although now i'm kinda not sure what are those things ( css variables, methodology, coherent, etc) as i just started learning 2 days ago but it's gonna be a good references for me as a i keep practicing. Will keep it in my mind, Thanks!! ππ
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