Design comparison
Community feedback
- @Islandstone89Posted 6 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" section. Wrap the card in a<main>
. -
You don't need to wrap every element in the card in a
<div>
. -
The alt text must also say where it leads(frontendmentor website). Do not include words like "image" or "photo", as screen readers automatically announce it as an image. A good alt text would be "QR code leading to the Frontend Mentor website."
-
.attribution
should be a<footer>
, and you should use<p>
for the text inside.
CSS:
-
Including a CSS Reset at the top is good practice.
-
Use the style guide to find the correct
background-color
. -
Remember to specify a fallback font:
font-family: 'Outfit', sans-serif;
. -
I like to add
1rem
ofpadding
on thebody
, to ensure the card doesn't touch the edges on small screens. -
On the card, remove
position
,transform
,max-width
,max-height
andoverflow
. -
To center the card horizontally and vertically, with some 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: 2rem;
-
Remove all widths and heights in
px
. Setting a fixed size is the number one reason for responsive issues. -
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 a big accessibility issue, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead. -
letter-spacing
must also never be inpx
. I would useem
. -
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. -
Remove
font-family
on the heading. When you set it onbody
, its descendants inherit the font. -
To create the space between the image and the edge of the card, set
padding
on all 4 sides of the card:padding: 1rem
. -
On the image, add
display: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. Remove the margin and the height.
Marked as helpful0 -
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