@Islandstone89
Posted
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. Change.container
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).
-
"Improve your" is a heading, not a paragraph. "Scan the QR code" on the other hand, is a paragraph, and must be a
<p>
, not a<span>
. -
.attribution
should be a<footer>
, and its text must be wrapped in a<p>
.
CSS:
-
You don't need to put anything on
html
, only thebody
. I would move all the properties on.container
over on thebody
, and changeheight
tomin-height
- this way, the content will not get cut off if it grows beneath the viewport. Also, addflex-direction: column
andgap: 2rem
. -
font-size
must never be in px. This is bad for accessibility, as it prevents the font size from scaling with the user's default setting in the browser. Use rem instead. -
The card should not have a
width
, only amax-width
of around20rem
, to prevent it from getting too wide on larger screens. -
On the image, add
display: block
and changewidth
tomax-width: 100%
- the max-width prevents it from overflowing its container. -
Paragraphs has a default value of
font-weight: 400
, so there is no need to declare it. -
As the design doesn't change, there is no need for any media queries. When you do need them, they should be in rem, not px. Also, it is common practice to do mobile styles first and use media queries for larger screens.
Marked as helpful
@Islandstone89 Wow, thank you so much for your precious observations, i will update the solution as per your points and surely use them in my future code.
@Islandstone89
hey, I did all of your points, plus, I changed height: 100%
in the body
to min-height:100vh
, when it was 100% it didn't take the full height and i do not understand why, if you know please tell me, also i have another question, when the width of the screen falls under 150 px, the card overflows to the left, how can I fix that?
@Islandstone89
Posted
@abdelrahmen no screens are less than 150px wide, so that's not a problem.