Design comparison
Community feedback
- @Islandstone89Posted 8 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 the "main" section of a page. Replace<section>
with a<main>
. -
The image has meaning, so it must have 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(frontendmentor.io).
-
Headings should always be in order, so you never start with a
<h4>
. Change it into a<h1>
.
CSS:
-
Including a CSS Reset at the top is good practice.
-
Add around
1rem
ofpadding
on thebody
, so the card doesn't touch the edges on small screens. -
Remove the margin on
main
. -
Remove the margin on the card.
-
To center the card horizontally and vertically, use Flexbox on the body:
display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100svh;
-
Remove all widths. And you should NOT use
!important
. -
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
Use numbers as values for
font-weight
. -
On the image, add
display: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. -
You do NOT need all those media queries! The layout of this component doesn't change, so you do not need ANY media queries. When they are needed, you should use rem instead of
px
. It is also common to do mobile styles as the default and use media queries for larger screens.
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