Design comparison
Solution retrospective
I'm very new to front end work and I am currently completing an intensive coding bootcamp. This is my first attempt at a Frontend Mentor challenge & only my second attempt at creating a CSS design. I think I've got close to the spec but I'm sure I didn't do it the "best way" so any advice on that would be great.
Community feedback
- @correlucasPosted about 2 years ago
👾Hi Daniel Earp, 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:
Add the website favicon inserting the svg image inside the
<head>
.<link rel="icon" type="image/x-icon" href="./images/favicon-32x32.png">
Add
<main>
instead of<div>
to wrap the card container. This way you show that this is the main block of content and also replace the div with a semantic tag.Replace the
<h3>
containing the main title with<h1>
note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading. Use the sequence h1 h2 h3 h4 h5 to show the hierarchy of your titles in the level of importance, never jump a level.Clean your code by removing some unnecessary divs, most of the content can stand alone without a div. Use div only for blocks that need a special alignment or the content needs a special positioning.
Add a margin of around
margin: 20px
to avoid the card touching the screen edges while it scales down.Use relative units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.Instead of using many padding and margins to separate the elements, add a single padding of
padding: 15px
only in the container to give the padding around the image and the text andpadding-bottom: 14px
to separate the texts and image vertically.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!
Marked as helpful0@Earpz1Posted about 2 years ago@correlucas Thanks for having a look over it and coming back with such a detailed answer. Your comment about adding padding to the main box rather than margin to all in individual elements inside makes so much sense and is clearly a much cleaner way of doing things. Appreciate it!
0 - @remtainePosted about 2 years ago
The design looks pretty good. For the content, it's better if instead of manually centering it through pixel margins, you center it using either auto margins or flex. That way you don't have to calculate every time. Also, the text at the bottom overflows. If you want them all contained in the parent white box, don't set a constant height and just add padding for spaces.
All in all it's good though! Keep it up!
Marked as helpful0@Earpz1Posted about 2 years ago@remtaine Thank you so much for taking the time to reply. I have another lecture today but will certainly go over it again and take another stab at it!
0 - @MurtazaKafkaPosted about 2 years ago
The design is great, except that it has just a bit of typography issue. You could possibly change the contrast of font color against the background color and add some "padding-bottom" to the description piece of text at the end. But still, this is really great. Keep it up.
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