Design comparison
Solution retrospective
I'm proud that I only used HTML and CSS.
What specific areas of your project would you like help with?My own landing page.
Community feedback
- @Islandstone89Posted 17 days 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" content. Wrap the card in a<main>
. -
Remove the inline styles on the image - while the HTML is responsible for the content and structure, its visual appearance belongs in the CSS.
-
"Improve your" is a heading. I would make it 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. -
.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.
-
box-sizing: border-box;
should be set on all elements, using the universal selector*
:
*, *::before, *::after { box-sizing: border-box; }
-
I recommend adding a bit of
padding
, for example16px
, on thebody
, to ensure the card doesn't touch the edges on small screens. -
height: fit-content
on the card is not needed. -
Remove the
width
inpx
on the card. We rarely want to give a component a fixed size, as we need 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. To solve this issue, give the card a
max-width
of around20rem
. -
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. -
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. -
Likewise, set the
font-family
on thebody
and remove it elsewhere. -
Paragraphs have a default value of
font-weight: 400
, so there is no need to declare it. -
On the image, add
display: block
,height: auto
andmax-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. -
I would increase the
padding
on the card to around16px
.
0@Feyre-headPosted 15 days ago@Islandstone89 Hey, thanks for you comment. I already made the modifications, hope I didn't forget anything ;) and if you would like to you are welcome to comment on my other exercise: https://www.frontendmentor.io/solutions/blog-preview-card-using-html-css-flexbox-4d0ANBJwIV
1 -
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