So erstellen Sie einen Altersrechner mit HTML-CSS und JavaScript

Wir haben hier die Datumsfunktion von JavaScript verwendet, um einen Altersrechner zu erstellen. Hier haben wir separate Funktionen für Jahr, Monat und Tag erstellt. Diese Funktionen sind aktiv, wenn Sie auf die Schaltfläche Berechnen klicken. Der Wert, der den aktuellen Tag vom Geburtsdatum subtrahiert, ist, ob wir den Monats- und Tageswert des Jahres mit den Bedingungen anzeigen.

Altersrechner mit HTML-CSS und JavaScript [Quellcode]

Dieser Quellcode kann Ihnen helfen, einen Altersrechner mit HTML-CSS und JavaScript zu erstellen

HTML Quelltext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=1">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>

<div class="age-calculate">
  <h1>Age Calculator</h1>
  <input type="date" id="birth_date" name="">
  <button id="calculate">Calculate</button>
	<div id="calculateAge"></div>
</div>
<script type="text/javascript" src="js/script.js"></script>
</body>
</html>

CSS-Code

*,*:after,*:before{
	-webkit-box-sizing: border-box;
	-moz-box-sizing: border-box;
	-ms-box-sizing: border-box;
	box-sizing: border-box;
}
body{
	font-family: arial;
	font-size: 16px;
	margin: 0;
	background: #072e4c;
	color: #000;
	
	display: flex;
	min-height: 100vh;
	align-items: center;
}

.age-calculate{
	max-width: 600px;
	width: 100%;
	color: #fff;
	margin: 0 auto;
	text-align: center;
	padding: 30px;
	border-radius: 30px;
	background: linear-gradient(to bottom, #007193 50%, #06024e);
}
h1{
	margin: 0 0 20px;
	text-transform: uppercase;
	letter-spacing: 2px;
	font-size: 36px;
}
.age-calculate input[type="date"]{
	width: 60%;
	display: block;
	margin: 0 auto 20px;
	font-size: 20px;
	padding: 10px;
	border-radius: 10px;
	border:0;
}
.age-calculate button{
	width: 60%;
  display: block;
  margin: 0 auto 10px;
  font-size: 16px;
  padding: 13px;
  border-radius: 10px;
  border: 0;
  background: #00a1ed;
  color: #fff;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
}
#calculateAge{
	font-size: 24px;
}

JavaScript-Code

var calculate = document.getElementById('calculate'),
  calculateAge = document.getElementById('calculateAge');

  calculate.addEventListener('click',function(){
    var birthDate = document.getElementById('birth_date').value;
    birthDate = new Date(birthDate);
    todayDate = new Date()
    totalAge = Date.now() - birthDate.getTime();
    ageYear = new Date(totalAge);
    ageYear = Math.abs(ageYear.getUTCFullYear() - 1970 );
    
    function ageMonth() {
      if(todayDate.getMonth() >= birthDate.getMonth()) {
          if(todayDate.getDate() >= birthDate.getDate()) {
              return todayDate.getMonth() - birthDate.getMonth();
          }
          else {
              if((todayDate.getMonth() - 1) >= birthDate.getMonth()) {
                  return (todayDate.getMonth() - 1) - birthDate.getMonth();
              }
              else {
                  return ((todayDate.getMonth() - 1) + 12) - birthDate.getMonth();
              }
          }
      }
        
    };
    function ageDay() {
        if(todayDate.getDate() > birthDate.getDate()) {
            return todayDate.getDate() - birthDate.getDate();
        }
        else if(todayDate.getDate() == birthDate.getDate()) {
            return todayDate.getDate() - birthDate.getDate();
        }
        else {
            let calDate = new Date(birthDate.getFullYear(), birthDate.getMonth(), 0);
            return (todayDate.getDate() + calDate.getDate()) - birthDate.getDate();
        }
    };
    calculateAge.innerHTML = "Your Age "+ageYear+" Years "+ageMonth()+ " Months "+ageDay()+" Days"

  });

What is GEEK

Buddha Community

Lyda  White

Lyda White

1628189100

How to Image Uploader with Preview || Html CSS JavaScript

Image Uploader with Preview || Html CSS JavaScript || #html #css #javascript #coding

#html #css #javascript 

code savvy

code savvy

1630506330

Product landing page using HTML CSS & JavaScript | web design

Knowledge

This video is about the product landing page using HTML CSS And JavaScript, in which we created a simple product landing page using HTML CSS and in order to perform  those powerful animations we use the GSAP a JavaScript animation library for work done.

In this video we broadly cover the concepts of CSS Flex box and CSS Grid system and Some CSS Properties such as nth child selector, ::before & ::after much more.

Don't forget to join the channel for more videos like this. Code Savvy

📁 Assets 
Icons : https://fontawesome.com/
Fonts : https://fonts.google.com/
GitHub : https://github.com/ananikets18
GSAP : https://greensock.com/gsap/

Outline ⏱

0:00 - Intro
0:10 - Result
0:38 - Project Setup
01:35 – Reset HTML
02:21 – Left Container HTML
03:41 – Wrapper
14:58 – Bottom Shoe Nav
26:23 – Right Container HTML
33:10 – Product Size
35:49 – Reviews
41:11 – GSAP Animations

Click to Watch Full tutorial on YOUTUBE

#html  #css  #javascript  #web-development #html5 

#html #css #tailwindcss #javascript 

code savvy

code savvy

1629473371

Web Design Speed Code | HTML, CSS, JavaScript (GSAP) | Portfolio Design

Portfolio Website Design with HTML, CSS & Javascript

 

Hello Everyone, In this video we'll create a Portfolio Page design using HTML, CSS & JavaScript (GSAP) 📁

🧠 Knowledge : 

Html, CSS (Flexbox), JavaScript DOM, Javascript Animations.

Anyway, you can learn everything mentioned. Follow the tutorial.

⏱ Outline

 

#css #javascript  #JavaScript  #HTML #html 

Click to Watch Full Tutorial 

anita maity

anita maity

1618667723

Sidebar Menu Using Only HTML and CSS | Side Navigation Bar

how to create a Sidebar Menu using HTML and CSS only. Previously I have shared a Responsive Navigation Menu Bar using HTML & CSS only, now it’s time to create a Side Navigation Menu Bar that slides from the left or right side.

Demo

#sidebar menu using html css #side navigation menu html css #css side navigation menu bar #,pure css sidebar menu #side menu bar html css #side menu bar using html css

Nandini roy

Nandini roy

1618667097

Responsive Personal Portfolio Website Using HTML CSS and JavaScript

Tutorial: https://youtu.be/9DDiorNZiyw

#create a portfolio website with html css javascript #personal portfolio complete website using only html css javascript #responsive portfolio website html css javascript #responsive personal portfolio website #portfolio website #responsive website