Design comparison
Solution retrospective
This is the first time I'm publishing code anywhere :)
What challenges did you encounter, and how did you overcome them?Im not sure if my html is semantically correct.
What specific areas of your project would you like help with?I really don't know how to control line of text. I used max-width: 25ch
to limit lenght of text but I don't know if it is done right.
Is h2
semantically appropriate for a component header?
Community feedback
- @Islandstone89Posted 9 months ago
Hi Chris, good job!
Here is what could be improved - I hope it helps :)
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. Wrap the card in a<main>
. -
The qr code is meaningful content and should be placed as an
<img>
, not as a background-image. It also needs to 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 website). -
It is OK to use
<h2>
for a component header. In a real-world scenario, several components would be on the same page. There can only be one<h1>
on a page, so the headings on the components are more suited as<h2>
.
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 width on the card. You should rarely set fixed sizes, as components need to be able to adapt to all kinds of screens.
-
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
Remove all properties on the image, except for
border-radius
. Adddisplay: block
andmax-width: 100%
- the max-width prevents it from overflowing its container.
Marked as helpful1@ks-web-workbenchPosted 9 months ago@Islandstone89 Thank you for the comprehensive feedback. It was really helpful.
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