Design comparison
Community feedback
- @Islandstone89Posted 10 days ago
Hi, congratulations on finishing this first challenge.
There are quite a few issues here, so it is vital that you apply my suggestions, and keep them in mind for your next project.
I hope my feedback is clear and helpful :)
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. Change the first<div>
into a<main>
. -
You don't need to wrap the image or the text in a
<div>
. -
The image has meaning, so it must 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(the frontendmentor website). A good alt text would be "QR code leading to the Frontend Mentor website."
-
Headings should always be in order, so you never start with a
<h3>
. 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.
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.
-
Use the style guide to find the correct
font-family
andbackground-color
. -
I recommend adding a bit of
padding
, for example16px
, on thebody
, to ensure the card doesn't touch the edges on small screens. -
It's common to change the default box-sizing value of
content-box
on all elements using the universal selector*
:
*, *::before, *::after { box-sizing: border-box; }
-
Remove the
html
selector, it doesn't need any styles. -
On the
body
, changeheight
tomin-height: 100svh
- this way, the content will not get cut off if it grows beneath the viewport. Remove thewidth
- since thebody
is a block element it takes up the full width by default. -
To center the card horizontally and vertically, with a bit of space between the
<main>
and the<footer>
, I would use Flexbox on the body:
display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100svh; gap: 2rem;
-
Remove all widths and heights.
-
Add a
max-width
of around20rem
on the card, to prevent it from getting too wide on larger screens. -
font-size
on.attribution
must also be in rem. Never set font sizes inpx
. -
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. -
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 to16px
. -
As the design doesn't change, there is no need for any media queries. When you do need them, they should be in
rem
orem
, notpx
. Also, it is common practice to do mobile styles first and use media queries for larger screens. -
Descendant selectors like
.content p
, increase specificity - it's better to give elements a class and use that as a selector.
Marked as helpful0@Ankita092005Posted 9 days ago@Islandstone89 Thank you so much for giving me your feedback! This was my first project! I will try to improve!
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