Design comparison
Solution retrospective
I found the project very straightforward and simple, the design was easy to follow. I only wonder if my code could be written better, particularly when it comes to centering the main div across the body. Is my solution for centering it a good method or does it have pitfalls if the screen is resized or the content is changed?
Community feedback
- @rayaattaPosted 10 months ago
Hello zainy2401π, congratulations on completing your first FED challenge π
I have some suggestions you might find useful.
1 Try to make your html more Semantic by wrapping the main page content inside a
<main>
tag . Replace<div class="card" role="main">
With<main class="card">
. This changes nothing visually but Using it is a better alternative to using the aria role when the element for it already exists. Using semantic markup improvesSEO
And user experience (accessibility) for people using assistive technology such as screen readers.
2 I noticed that you used
h2
.since it is the only heading in the document you should replace it with<h1>
.Here's a quick guide on how to use them:
The
<h1>
to<h6>
tags are used to define HTML headings.<h1>
defines the most important heading.<h6>
defines the least important heading. Only use one<h1>
per page - this should represent the main heading/subject for the whole page. Also, do not skip heading levels - start with<h1>
, then use<h2>
, and so on. You can then style them in you css.Unlike what most people think, it's not just about the size and weight of the text It is about maintaining a clear and consistent hierarchy through out the document
3 To body, replace
height: 100vh;
with
min-height:100vh;
This prevents content overflowing on short devices or mobile devices in landscape orientation.
4 You used
width: 400px;
On the.card
This is okay but in case a screen is less than 400px wide then the card overflows the view port. You can make it more responsive by usingmax-width:min(90%,400px)
This means it is 400px but on smaller screens it only covers 90% of the width.I hope this helps π
Your solution is awesome π
Happy coding broβοΈ
Marked as helpful1@zainy2401Posted 10 months ago@rayaatta I really appreciate your comments its going to helping me become a better coder! I'm going to make these changes and remember your comments in the future, Thanks!
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