<!DOCTYPE html>
<html>
<head>
<style>
* {
margin :0;
padding:0;
box-sizing:border-box;
outline:none;
}
.wrapper {
position:absolute;
top :0;
left:0;
width :100%;
height:100%;
overflow:hidden;
}
.page {
position:absolute;
top :0;
left:0;
width :100%;
height:100%;
padding:10px;
background-color:#eee;
overflow-y:auto;
overflow-x:hidden;
}
.banner {
position:absolute;
top :0;
left:0;
width :100%;
height:50%;
background-color:#fff;
}
.banner img.banner-img {
height:300px;
filter:brightness(0.8);
animation:glide 8s alternate infinite
ease-in-out;
}
.banner .banner-title {
position:absolute;
left:50%;
top :50%;
font-size:50px;
color:#fff;
text-align:center;
transform:translate(-50%,-50%);
}
.banner .banner-title::first-line {
font-size:36px;
}
.banner .question {
position:absolute;
display:flex;
align-items:center;
justify-content:center;
z-index:1;
left:50%;
top :100%;
width :100px;
height:100px;
font-size:50px;
color:#454546;
background-color:#fff;
border-radius:50%;
box-shadow:0 0 10px rgba(0,0,0,.5);
transform:translate(-50%,-50%);
transition:all 300ms ease-out;
animation:float-min 3s alternate infinite
ease-in-out;
}
.banner .question:active{
background-color:#454546;
color:#fff;
}
.input {
position:absolute;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
bottom:0;
left:0;
width :100%;
height:50%;
background-color:#fff;
}
.input .row {
position:relative;
width:200px;
}
.input .row input {
display:block;
height:40px;
width:100%;
padding-left:10px;
border:2px solid #ccc;
border-radius:5px;
color:#454546;
background-color:#eee;
}
.input .row select {
display:block;
height:40px;
width:100%;
margin:10px 0;
padding-left:10px;
background-color:#eee;
border-radius:5px;
text-align:center;
color:#454546;
border:2px solid #ccc;
}
.input p{
padding:20px;
color:#888;
text-align:center;
}
.card {
position:relative;
display:flex;
overflow:hidden;
width :100%;
height:200px;
margin-top:10px;
border-radius:5px;
background-color:#fff;
box-shadow:0 0 5px rgba(0,0,0,.25);
}
.card:first-child {
margin-top:0;
}
.card .planet {
position:relative;
display:flex;
align-items:center;
justify-content:center;
flex:1;
background-color:#212121;
}
.card .planet .name {
position:absolute;
left:50%;
bottom:20px;
font-size:18px;
color:#fff;
transform:translate(-50%,0);
}
.card img{
width :120px;
height:120px;
margin-bottom:30px;
animation:float 3s infinite alternate
ease-in-out;
}
.card .info {
flex:1;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
color:#454546;
}
.card .info .age {
font-size:48px;
font-weight:bold;
}
@keyframes float {
0%{
margin-top:-10px;
}
100%{
margin-top: 10px;
}
}
@keyframes float-min {
0%{
margin-top:-5px;
}
100%{
margin-top: 5px;
}
}
@keyframes glide {
0%{
margin-left:0px;
}
100%{
margin-left:-20px;
}
}
.result {
position:absolute;
opacity:0;
left:0;
width :100%;
height:100%;
padding:10px;
margin-top:100vh;
background-color:#eee;
overflow-y:auto;
overflow-x:hidden;
transition:all 200ms ease-out;
z-index:1;
}
.open {
margin-top:0;
opacity:1;
}
</style>
<title>How Old Are You ?</title>
</head>
<body>
<script>
const factors = [
88 ,
225 ,
365 ,
687 ,
4333 ,
10756 ,
30688 ,
60193 ,
90555
];
alert("Enter you Date of Birth and click on question mark but remember that,this is made on Earth by chrismory , we code for the future");
const ms = 86400000 ;
function calcAge(day){
var age = [] ;
var td = new Date();
var d ;
d = (td.getTime() - day.getTime())/ms ;
for(var i=0;i<8;i++){
var a = d/factors[i];
age.push(a.toFixed(2));
}
return age ;
}
function submit(){
var date ;
var month ;
var year ;
date = document.getElementById("date").value;
month = document.getElementById("month").selectedIndex ;
year = document.getElementById("year").value ;
if(date=="" || year==""){
return 0;
}
var d = new Date(year,month,date) ;
var age = calcAge(d)
showAge(age);
}
function showAge(age){
var lbl ;
lbl= document.getElementsByClassName("age");
for(var i=0;i<lbl.length;i++){
lbl[i].innerHTML = age[i];
}
document.getElementById("pa").classList.add("open");
}
</script>
<div class="wrapper">
<div class="page">
<div class="banner">
<img class="banner-img" src="https://dl.dropbox.com/s/wbxgneqf3xj5eor/Backgroung.jpg">
<p class="banner-title">
HOW OLD ARE YOU
</p>
<div class="question"
onclick="submit()">
?
</div>
</div>
<div class="input">
<div class="row">
<input type="number" id="date"
placeholder="Date">
<select id="month"
placeholder="Month">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
<input type="number" id="year"
placeholder="Year">
</div>
</div>
</div>
<div class="result" id="pa">
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/7vf2e8qlhk16ix2/mercury-removebg-preview.png">
<div class="name">
MERCURY
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/7ymzirrf3l7poh0/venus-removebg-preview.png">
<div class="name">
VENUS
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/n5arpbvatufs3md/earth-removebg-preview.png">
<div class="name">
EARTH
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/jaa690bwv2nnfzj/mars110101-removebg-preview.png">
<div class="name">
MARS
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/e5ayue3qnayxy06/jupiter-removebg-preview.png">
<div class="name">
JUPITER
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://dl.dropbox.com/s/x0d7hga6f4otn7w/saturn-removebg-preview.png">
<div class="name">
SATURN
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://solarsystem.nasa.gov/system/feature_items/images/88_carousel_uranus.jpg">
<div class="name">
URANUS
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
<div class="card">
<div class="planet">
<img src="https://solarsystem.nasa.gov/system/feature_items/images/82_carousel_neptune_1.jpg">
<div class="name">
NEPTUNE
</div>
</div>
<div class="info">
<div class="age">
0
</div>
<div>
Years
</div>
</div>
</div>
</div>
</div>
</body>
</html>