Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Age calculator with html, css, and jquery

vernonroqueβ€’ 60

@vernonroque

Desktop design screenshot for the Age calculator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

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

@AlfredoPegueroC

Posted

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 helpful

1

vernonroqueβ€’ 60

@vernonroque

Posted

@AlfredoPegueroC Thanks for your help! I'll give it a try. All the best! Happy coding :)

0
Olaniyi Ezekielβ€’ 7,600

@Ezekiel225

Posted

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 helpful

1

vernonroqueβ€’ 60

@vernonroque

Posted

@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
Daniel πŸ›Έβ€’ 44,230

@danielmrz-dev

Posted

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 helpful

0

vernonroqueβ€’ 60

@vernonroque

Posted

@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

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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