
Design comparison
Community feedback
- P@Islandstone89Posted 16 days 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. Change.container
to a<main>
. -
All images must have alt text. If the image is decorative, it should have empty alt text:
alt=""
. This image has meaning, so it needs a proper alt text. 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." -
"Improve your front-end skills by building projects" is a heading, not a paragraph. Headings must always be in order, so you would never start with a
<h3>
. I would make it a<h2>
- a page should only have one<h1>
, reserved for the main heading. As this is a card heading, it would likely not be the main heading on a page with several components.
CSS:
-
Make a habit of including a modern CSS Reset at the top of the stylesheet.
-
Remember to specify fallback fonts, in case the font doesn't load on the user's device:
font-family: 'Outfit', system-ui, sans-serif;
. Also, movefont-family
to thebody - the descendants of the
body`` will inherit the value. -
Move the styles on
.container
tobody
. -
On the
body
:- Change
height
tomin-height: 100svh
— this way, the content will not be cut off if it grows beneath the viewport. - Replace
padding: 0
withpadding: 16px
- giving it some padding ensures the card doesn't touch the edges on small screens. - Remove
overflow:hidden
, it is not needed.
- Change
-
Remove all widths and heights in
px
. We rarely want to give a component a fixed size, as we need it to grow and shrink according to the screen size. -
max-width
on the card should be in rem. Around20rem
works well. -
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 has poor contrast. Inspecting it in DevTools shows a contrast ratio of
3.94
, lower than the Web Content Accessibility Guidelines minimum requirement of4.5
. -
To create the space between the image and the edge of the card, set
padding
on all 4 sides of the card:padding: 16px;
. -
Remove
margin-top
on the image. Adddisplay: block
,height: auto
andmax-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.
0 -
- @tanadolMoPosted 16 days ago
Adjusting the font size and image size would make it perfect.
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