Design comparison
Solution retrospective
I had to look up different practices of how to create a div in the middle of the page. The way I centered my div may not be the most effective way. What would be the best way to gauge the size and fonts?
Community feedback
- @correlucasPosted about 2 years ago
👾Hi Sue Yang, congratulations for your first solution!👋 Welcome to the Frontend Mentor Coding Community!
Great solution and great start! Amazing that you've used different colors, this gave a personal touch to your solution. I’ve few suggestions to you that you can consider to add to your code:
1.Use
<main>
instead of<div>
to wrap the card container. This way you show that this is the main block of content and also replace the div with a semantic tag.2.Replace the
<div>
containing the main title with<h1>
note that this title is the main heading for this page and every page needs one h1 to show which is the most important heading. Use the sequence h1 h2 h3 h4 h5 to show the hierarchy of your titles in level of importance, never jump a level.3.Add a margin of around
margin: 20px
to avoid the card touching the screen edges while it scales down.4.Use units as
rem
orem
instead ofpx
to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.✌️ I hope this helps you and happy coding!
Marked as helpful0 - @MOSCOW2022Posted about 2 years ago
Hello sir the easiest way to center a div is like this: `
body { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; } ` also the background- color isnt the same so you should change that , its ok to get stuck at the start we all did that s how you learn i wish you a happy coding!
0 - @marconarcaPosted about 2 years ago
You can use either grid or flex to center your div if you know what I mean and it's best to use rem for fonts size
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