Skip to content

Commit a3d4276

Browse files
authored
Merge branch 'main' into supritha
2 parents 38af836 + 4f51e14 commit a3d4276

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+40431
-0
lines changed

Age Calculator/container.png

138 KB
Loading

Age Calculator/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="style.css">
8+
<title>Age Calculator</title>
9+
</head>
10+
<body>
11+
<div class="container">
12+
<p id="currDate"> </p>
13+
<p>Enter the DOB in format : (MM/DD/YYYY)</p>
14+
<input type="text" placeholder="Enter your D.O.B" id="DOB">
15+
<button id="CalcAge">Age</button>
16+
</div>
17+
<div id="displayAge">
18+
<p id="age"></p>
19+
</div>
20+
<script src="script.js">
21+
</script>
22+
</body>
23+
</html>

Age Calculator/readme.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
# Welcome 🖐 to the Age Calculator
3+
It is a simple Javascript project which calculates our age in years.
4+
5+
## Default view
6+
![Default View](container.png)
7+
![Default View](result.png)
8+
9+
## 💻Tech Stack
10+
<br>
11+
12+
![HTML](https://img.shields.io/badge/html5%20-%23E34F26.svg?&style=for-the-badge&logo=html5&logoColor=white)
13+
![CSS](https://img.shields.io/badge/css3%20-%231572B6.svg?&style=for-the-badge&logo=css3&logoColor=white)
14+
![JS](https://img.shields.io/badge/javascript%20-%23323330.svg?&style=for-the-badge&logo=javascript&logoColor=%23F7DF1E)
15+
16+
<br>
17+
18+
### How to use:
19+
20+
---
21+
22+
- Download or clone the repository
23+
24+
```
25+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
26+
```
27+
28+
- Go to the directory
29+
- Run the index.html file
30+
- Enter your DOB and find age..
31+
32+
<br>
33+
34+
## Happy Coding!

Age Calculator/result.png

123 KB
Loading

Age Calculator/script.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
let currDate= document.getElementById("currDate");
2+
let dateOfBirth = document.querySelector("#DOB");
3+
const CalcAge= document.getElementById("CalcAge");
4+
const displayAge= document.getElementById("displayAge");
5+
const Age= document.getElementById("age");
6+
var today = new Date();
7+
currDate.innerText=`Today's Date is : ${today.toLocaleDateString('en-US')}`;
8+
9+
CalcAge.addEventListener("click",()=>{
10+
var birthDate = new Date(dateOfBirth.value);
11+
var age = today.getFullYear() - birthDate.getFullYear();
12+
var m = today.getMonth() - birthDate.getMonth();
13+
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
14+
age = age - 1;
15+
}
16+
displayAge.style.visibility="visible";
17+
Age.innerText=`You are ${age} years old.`
18+
});
19+

Age Calculator/style.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
*{
2+
margin:0;
3+
padding:0;
4+
box-sizing:border-box;
5+
font-family:cursive;
6+
}
7+
.container{
8+
display:flex;
9+
width:600px;
10+
margin:auto;
11+
margin-top:10%;
12+
margin-bottom:10%;
13+
align-items:center;
14+
justify-content:center;
15+
flex-direction:column;
16+
background-color:darkslateblue;
17+
box-shadow:8px 8px black;
18+
color:white;
19+
padding:5% 0%;
20+
}
21+
#currDate{
22+
font-size:40px;
23+
margin:20px;
24+
font-weight:bold;
25+
}
26+
input{
27+
font-size:20px;
28+
padding:15px;
29+
margin:20px;
30+
text-align:center;
31+
border-radius:20px;
32+
border:1px solid yellow;
33+
cursor:pointer;
34+
}
35+
button{
36+
font-size:20px;
37+
padding:10px 20px;
38+
border-radius:10px;
39+
border:none;
40+
background-color:yellow;
41+
color:black;
42+
margin:20px;
43+
text-transform: uppercase;
44+
font-weight:bold;
45+
cursor:pointer;
46+
}
47+
button:hover{
48+
background-color:white;
49+
color:blue;
50+
}
51+
52+
#displayAge{
53+
display:flex;
54+
align-items:center;
55+
justify-content:center;
56+
width:620px;
57+
height:480px;
58+
background-color:rgb(228, 91, 91);
59+
border-radius:30px;
60+
position:absolute;
61+
top:19%;
62+
left:30%;
63+
visibility: hidden;
64+
}
65+
#age{
66+
color:white;
67+
font-size:50px;
68+
margin:20px;
69+
font-weight:bold;
70+
}

Clock/Analog Clock/clock.png

5.88 KB
Loading

Clock/Analog Clock/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<link rel="stylesheet" href="style.css">
9+
<title>Analog Clock</title>
10+
</head>
11+
12+
<body>
13+
<div class="clock">
14+
<div class="hour">
15+
<div class="hr" id="hr"></div>
16+
</div>
17+
<div class="min">
18+
<div class="mn" id="mn"></div>
19+
</div>
20+
<div class="sec">
21+
<div class="sc" id="sc"></div>
22+
</div>
23+
</div>
24+
<script src="script.js"></script>
25+
</body>
26+
27+
</html>

Clock/Analog Clock/script.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const hr = document.querySelector("#hr");
2+
const mn = document.querySelector("#mn");
3+
const sc = document.querySelector("#sc");
4+
5+
const deg = 6;
6+
7+
setInterval(() => {
8+
let day = new Date();
9+
let hh = day.getHours() * 30;
10+
let mm = day.getMinutes() * deg;
11+
let ss = day.getSeconds() * deg;
12+
console.log(hh);
13+
console.log(mm);
14+
console.log(ss);
15+
hr.style.transform = `rotate(${hh+(mm/12)}deg)`;
16+
mn.style.transform = `rotate(${mm}deg)`;
17+
sc.style.transform = `rotate(${ss}deg)`;
18+
});

Clock/Analog Clock/style.css

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}
6+
7+
body {
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
min-height: 100vh;
12+
background-color: #091921;
13+
}
14+
15+
.clock {
16+
width: 350px;
17+
height: 350px;
18+
background: url("clock.png");
19+
background-size: cover;
20+
display: flex;
21+
justify-content: center;
22+
align-items: center;
23+
border-radius: 50%;
24+
border: 4px solid #091921;
25+
box-shadow: 0 -15px 15px rgba(255, 255, 255, 0.25),
26+
inset 0 -15px 15px rgba(255, 255, 255, 0.05), 0 15px 15px rgba(0, 0, 0, 0.3),
27+
inset 0 15px 15px rgba(0, 0, 0, 0.3);
28+
}
29+
30+
.clock::before {
31+
content: "";
32+
position: absolute;
33+
width: 15px;
34+
height: 15px;
35+
background: #848484;
36+
border: 2px solid #fff;
37+
z-index: 10;
38+
border-radius: 50%;
39+
}
40+
41+
.hour,
42+
.min,
43+
.sec {
44+
position: absolute;
45+
}
46+
47+
.hour,
48+
.hr {
49+
width: 160px;
50+
height: 160px;
51+
}
52+
53+
.min,
54+
.mn {
55+
width: 190px;
56+
height: 190px;
57+
}
58+
59+
.sec,
60+
.sc {
61+
width: 230px;
62+
height: 230px;
63+
}
64+
65+
.hr,
66+
.mn,
67+
.sc {
68+
display: flex;
69+
justify-content: center;
70+
/* align-items: center; */
71+
position: absolute;
72+
border-radius: 50%;
73+
}
74+
75+
.hr::before {
76+
content: "";
77+
position: absolute;
78+
width: 8px;
79+
height: 80px;
80+
background: #848484;
81+
z-index: 1;
82+
border-radius: 6px 6px 0 0;
83+
}
84+
85+
.mn::before {
86+
content: "";
87+
position: absolute;
88+
width: 4px;
89+
height: 90px;
90+
background: #d6d6d6;
91+
z-index: 2;
92+
border-radius: 6px 6px 0 0;
93+
}
94+
95+
.sc::before {
96+
content: "";
97+
position: absolute;
98+
width: 2px;
99+
height: 150px;
100+
background: #ff6767;
101+
z-index: 3;
102+
border-radius: 6px 6px 0 0;
103+
}
104+
105+

0 commit comments

Comments
 (0)