@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. Since the card is the only main content, you can change.container
to 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).
-
Headings should always be in order, so you never start with a
<h3>
. Change it into a<h1>
. "Improve your front-end skills by building projects" should be wrapped in one<h1>
. -
Similarly, the paragraph text only needs one
<p>
.
CSS:
-
It's good practice to include a CSS Reset at the top.
-
Set the
font-family
on thebody
instead of*
, that is common practice. -
height
onbody
must bemin-height
- this way, the content will not get cut off if it grows beneath the viewport. -
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. -
Remove
width
andmargin
on the image, and adddisplay: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. -
Remove
height
from the card - you should never set a height on elements containing text (and mostly not otherwise,too). On my laptop screen, the paragraph overflows the card, as the card content has grown taller than the card height. -
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
To create the space between the image and the edge of the card, set
padding
on all 4 sides of the card. -
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.