Design comparison
Solution retrospective
Open to improvement, thanks!
Community feedback
- @S067130HPosted 9 months ago
Hey there! Great job on the solution, it looks great!
One thing I noticed though was your use of the <main> HTML element. This is what is known as a semantic element and is used to encompass the main section of your website. I noticed you attached a container class to it. Since there can ever only be one main element tag inside a document, applying classes should not be necessary. Instead, you might want to consider a structure like so:
<body> <main> <div class="container"> [...] </div> </main> </body>
This helps with accessibility when it comes to things like screen readers. Other than that, great job! :)
Marked as helpful0@turtle-jinPosted 9 months ago@S067130H
Thanks for the feedback! I have updated the semantic element based on your suggestion:)
0 - @Islandstone89Posted 9 months ago
Hello! Good job. Here are a few tips :)
HTML:
- Do not use words like "picture", "image" or "photo" in the alt text. Screen readers start announcing images with "image", so an alt text of "image of qr code" would be read like this: "image, image of qr code". And how it looks isn't as important as what it does, so you don't need to include the bit about the "blue background". The alt text must also say where it leads(frontendmentor.io).
CSS:
-
Performance-wise, it's better to link fonts in the
<head>
of the HTML than using@import
. -
It's good practice to include a CSS Reset at the top.
-
Add around
1rem
ofpadding
on thebody
, so the card doesn't touch the edges on small screens. -
Move
font-family
tobody
. -
The
body
is a block element, meaning it takes up the full width by default. Hence, you don't need to set thewidth
. -
On the
body
, changeheight
tomin-height
- this way, the content will not get cut off if it grows beneath the viewport. -
Remove the
width
on the card - in general. setting fixed widths and heights is not recommended. -
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
font-size
must never be in px. This is bad for accessibility, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead. -
Since all of the text should be centered, you only need to set
text-align: center
on the body, and remove it elsewhere. The children will inherit the value. -
Paragraphs have a default value of
font-weight: 400
, so there is no need to declare it. -
On the image, remove
height
andobject-fit
, neither are needed. Adddisplay: block
and changewidth
tomax-width: 100%
- the max-width prevents the image from overflowing its container.
Marked as helpful0@turtle-jinPosted 9 months ago@Islandstone89 Thank you so much for the tips! I definitely learned a lot from you! I will update my code using your tips and for future challenges:)
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