Design comparison
Community feedback
- @Islandstone89Posted 2 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. Change the first<div>
into a<main>
. -
The image must have alt text. This is essential for screen readers to understand the image. The alt text should be descriptive, and in this example, it also needs to say where it leads (frontendmentor.io). A good alt text would be "QR code leading to the Frontend Mentor website."
-
I would change the heading to 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:
-
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">
. -
Including a CSS Reset at the top is good practice.
-
I would recommend adding
1rem
ofpadding
on thebody
, to ensure the card doesn't touch the edges on small screens. -
Move
font-family
from*
tobody
. -
I would move the styles on
.flexbox
to thebody
- the<main>
does not need any styles. Also, changeheight
tomin-height
- this way, the content will not get cut off if it grows beneath the viewport. -
Remove the
width
in px on the card. We rarely want to give a component a fixed size, as we want it to grow and shrink according to the screen size. -
We do want to limit the width of the card, so it doesn't get too wide on larger screens. Give the card a
max-width
of around20rem
to solve this issue. -
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. -
Remove
font-weight
andtext-align
from<p>
, you don't need to declare neither of them. Paragraphs have a default value offont-weight: 400
, so there is no need to set it explicitly.text-align
is a property that gets passed down to its children. This means that if you settext-align: center
on the card, all of the card content will inherit the value from their parent. -
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
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. Remove the margin.
Marked as helpful0 -
- @yahappylemonPosted 2 months ago
I'm not familiar with Grid so I'm afraid I can't give too much feedback on that part, but the rest seems amazing!Well-done!!
This is a peer review required by the challenge.
0@yahappylemonPosted 2 months ago@dev-gideon Sorry, I'm not on discord. But still thanks!!
0@dev-gideonPosted 2 months ago@yahappylemon Youtube-link: https://youtu.be/rg7Fvvl3taU?si=nVnANR1OsTegAjBE https://youtu.be/3T0gjtXRNC0?si=PK3-oaFpb9fHXnq9 https://youtu.be/0xMQfnTU6oo?si=0uEcxvkMhY0Bep8W https://youtu.be/EiNiSFIPIQE?si=ph7bwYZbx0vzDdvI
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