Design comparison
SolutionDesign
Community feedback
- @izzatrazabPosted over 1 year ago
Nice work on completing the challenge. š
I have some suggestions on your code that may help you.
- Set height of html and body to 100%, why ? this will make centering any contents much easier and will avoid extra white space at the bottom of the page or when zooming (though this does not happens in your case). To do that:
html{ height: 100%;ā } body { min-height: 100%;ā background-color: hsl(30, 38%, 92%); }
- To center the card: Instead of using margin which is not responsive and akward, I would suggest using
display:flex;
. Now that we already set height of html and body element to 100% before, there will be no awkward slightly offset position because they are covering you viewport 100% (in desktop view, your card is a little bit off to the top):
body { min-height: 100%; display: flex;ā justify-content: center;ā align-items: center;ā background-color: hsl(30, 38%, 92%); } .pricecard { width: 90%; /* margin: 2em auto 2em auto; */ā background-color: hsl(0, 0%, 100%); border-radius: 20px; max-width: 600px; } @media (min-width:600px) { .pricecard { display: flex; max-width: 500px; /* margin-top: 10em; */ā }
- Landmark main element: I see that you did not use main element. This is actually bad practice as using landmark helps screen reader users easily navigate your website. But why? Look here briefly: HTML5 landmark elements are used to improve navigation. Try evaluate your deployed website here. Though you don't have to stress out too much on this because it will make sense to you the more you practice. I would do this instead:
<main class="pricecard">ā <div class="pricecard">ā ... </div>ā </main>ā
I downloaded your code and tried all the above locally and it works fine. If you found this helpfull, please upvote this comment as it will help me improve. That's all from me, adios.
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