Design comparison
Solution retrospective
I’m proud that I was able to complete this task simply and without any hassle. What I will do differently next time is thoroughly read the instructions instead of rushing to code, as this caused me to lose a lot of time
What challenges did you encounter, and how did you overcome them?I really didn’t encounter any problems at all.
What specific areas of your project would you like help with?None
Community feedback
- @Islandstone89Posted 3 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 a page's "main" section. Change.container
to a<main>
. -
For the 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(the frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website."
-
I would change the heading to 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. The footer needs to be outside of the main, not inside it.
CSS:
-
It is best practice to write CSS in a separate file, often called
style.css
. Create one in the same folder as theindex.html
, and link to it in the<head>
:<link rel="stylesheet" href="style.css">
. -
Including a CSS Reset at the top is good practice.
-
I like to add
1rem
ofpadding
on thebody
, to ensure the card doesn't touch the edges on small screens. -
Move
background-color
fromhtml
tobody
. -
Move the properties on
.container
tobody
. You can remove the.container
selector, as it doesn't need any styles. Changeheight
tomin-height
- this way, the content will not get cut off if it grows beneath the viewport. Addflex-direction: column
(makes the footer go under the main instead of beside it) andgap: 2rem;
(creates space between the main and the footer). -
Remove
display: inline-block
on the card, it is not needed. -
Remove
justify-content: center
on the card - it doesn't work without first declaringdisplay: flex;
. However, this is not needed. -
Remove all widths and heights in
px
- it is rarely smart to apply fixed sizes, as it prevents components from adapting to different devices. -
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
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. -
letter-spacing
must also never be inpx
. You can useem
, where1em
equals the font size of the element. -
On the image, add
display: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. Remove the margin. If needed, you can addmargin-bottom
to separate it from the text. -
To create the space between the image and the edge of the card, set
padding
on all 4 sides of the card:padding: 1rem;
. -
I would use
px
instead of%
onborder-radius
.
0 -
- @jason-sj-leePosted 3 months ago
Looks good! Placement of the card looks a little lower than the design but no actual issues. For the code, a separate CSS file might be better just for overall readability and keeping code modular.
0
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