Design comparison
Community feedback
- @Islandstone89Posted 7 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. Wrap.container
in a<main>
. -
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(frontendmentor.io).
-
Headings should always be in order, so you never start with a
<h3>
. Change it into a<h1>
. -
.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
. -
Add around
1rem
ofpadding
on thebody
, so the card doesn't touch the edges on small screens. -
Remove the margin on the card.
-
Add
min-height: 100svh
andgap: 2rem
on thebody
. -
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
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. -
On the image, add
display: block
andmax-width: 100%
- the max-width prevents it from overflowing its container. -
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.
Marked as helpful2@diksha-singh-17Posted 7 months agoHey,@Islandstone89 I appreciate your code review! Your insights and suggestions are valuable to me. I'll go through each point you mentioned and make the necessary improvements.
1 -
- @DinosMpoPosted 7 months ago
Hello, nice try for starter, some advice that i could give are that you could use the display: flex; justify-content: center; align-items: center; height: 100vh; in your .container class to be able to center your element to the center of the screen. Another one is for the text__area container that you use, try to use a class to the paragraph something like class='description' and give it the text-align: center; to be able to center your text. Also try to write your css to a separate file just to have a cleaner html code and more maintainable css code. I hope that i gave you some help and good advice
Marked as helpful2@diksha-singh-17Posted 7 months agoHey, thanks a lot for taking the time to review my code! I found your feedback helpful, and I'll make the suggested changes.
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