Design comparison
Solution retrospective
Here is my completed project of the age calculator.
I want to ask everyone how you included the leap year in your calculations. Any suggestions?
Community feedback
- @AlfredoPegueroCPosted 9 months ago
Hello, @vernonroque
With the next function, you can retrieve the days of each month.
function daysInMonth(month, year) { return new Date(year, month, 0).getDate(); }
I hope it helps.
Marked as helpful1@vernonroquePosted 9 months ago@AlfredoPegueroC Thanks for your help! I'll give it a try. All the best! Happy coding :)
0 - @Ezekiel225Posted 9 months ago
Hello there π @vernonroque.
Good job on completing the challenge !
Your project looks really good!
I have suggestions about your code that might interest you.
Consider adding a min-height of 100vh to the body element so as to centralize your project.
body { min-height: 100vh; align-items: center; display: flex; justify-content: center; }
I hope it helps!
Other than that, great job!
Happy coding.
Marked as helpful1@vernonroquePosted 9 months ago@Ezekiel225 Thank you for your suggestion! This seems like an easier way to center elements. I'll make sure to do it for the next project. Happy coding :)
0 - @danielmrz-devPosted 9 months ago
Hello
Your solution looks great!
I have two suggestions for improvement:
- Use
<main>
to wrap the main content instead of<div>
.
π Tags like
<div>
and<span>
are typical examples of non-semantic HTML elements. They serve only as content holders but give no indication as to what type of content they contain or what role that content plays on the page.This tag change does not impact your project visually and makes your HTML code more semantic, improving SEO optimization as well as the accessibility of your project.
- Also, using
margin
is not the best option to center an element. Here's a very efficient (and better) way to place an element in the middle of the page both vertically and horizontally:
π Apply this to the body (in order to work properly, don't use position or margins):
body { min-height: 100vh; display: flex; /* it works with grid too */ justify-content: center; align-items: center; }
I hope it helps!
Other than that, great job!
Marked as helpful0@vernonroquePosted 9 months ago@danielmrz-dev Thanks for your recommendations. I never thought that html elements would play a role in SEO Optimization. Thanks for also giving me a better way to center elements. I'll keep it in mind for the next project. Happy coding :)
1 - Use
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