
Design comparison
Solution retrospective
I am proud of how I did not need to work my brain so much. Means I still got it in me
What challenges did you encounter, and how did you overcome them?Only Thing that posed a bit of a challenge was the semantic tags, not used to them
What specific areas of your project would you like help with?I am good
Community feedback
- P@Islandstone89Posted 3 months ago
HTML:
-
Every webpage needs a
<main>
that wraps all of the content, except for<header>
andfooter>
. This is vital for accessibility, as it helps screen readers identify a page's "main" content. Wrap the card in a<main>
. -
Remove all of the inline styles.
-
The alt text should be written naturally, without using
-
between the words. Write something short and descriptive, without including words like "image" or "photo". 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". The alt text must also say where it leads(the frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website." -
You can remove the
<figure>
, it is not needed. -
Make "Improve your" a
<h2>
and "Scan the QR code" a<p>
. -
Wrap footer text in a
<p>
.
CSS:
-
It is best practice to write CSS in a separate file, often called
style.css
. Create one in the same folder as theindex.html
, and link to it in the<head>
:<link rel="stylesheet" href="style.css">
. -
Make a habit of including a proper CSS Reset at the top of the stylesheet.
-
I recommend adding a bit of
padding
, for example16px
, on thebody
, to ensure the card doesn't touch the edges on small screens. -
Move
font-family
tobody
, and remove it elsewhere - the children inherit the font. Remember to also specify fallback fonts:font-family: 'Outfit', system-ui, sans-serif;
-
To center the card horizontally and vertically, with a bit of space between the
<main>
and the<footer>
, I would use Flexbox on the body:
display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100svh; gap: 20px;
-
Remove the margin on the card - it is not needed, since it is centered using Flexbox.
-
max-width
on the card should be in rem. Around20rem
works well. -
On the card, use
px
instead of%
forborder-radius
. -
font-size
must never be in px. This is a big accessibility issue, 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. -
The paragraph text needs better contrast. If you inspect it in DevTools (click
F12
), it shows a contrast ratio of3.97
, which is below the Web Content Accessibility Guidelines minimum requirement of4.5
. So, make the color slightly darker - changingopacity: 50%
toopacity: 60%
gives it a ratio of5.74
, which is acceptable. -
To create the space between the image and the edge of the card, set
padding
on all 4 sides of the card:padding: 16px;
. -
On the image, add
display: block
,height: auto
and changewidth
tomax-width: 100%
- the max-width prevents it from overflowing its container. Without this, an image would overflow if its intrinsic size is wider than the container.max-width: 100%
makes the image shrink to fit inside its container.
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