Skip to content

Commit 4c78f2d

Browse files
committed
mini calculator
1 parent daaa7b2 commit 4c78f2d

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

19. Mini Calendar/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Mini Calendar</title>
7+
<link rel="stylesheet" href="style.css">
8+
<script defer src="script.js"></script>
9+
</head>
10+
<body>
11+
<div class="container">
12+
<div class="calendar">
13+
<div class="left">
14+
<p id="date">01</p>
15+
<p id="day">Sunday</p>
16+
</div>
17+
<div class="right">
18+
<p id="month">January</p>
19+
<p id="year">2024</p>
20+
</div>
21+
</div>
22+
</div>
23+
</body>
24+
</html>

19. Mini Calendar/script.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const date = document.getElementById('date');
2+
const day = document.getElementById('day');
3+
const month = document.getElementById('month');
4+
const year = document.getElementById('year');
5+
6+
7+
const toDay = new Date();
8+
// console.log(toDay);
9+
10+
const weekDays = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
11+
const allMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
12+
13+
14+
date.innerHTML = (toDay.getDate()<10 ? "0":"") + toDay.getDate(); // to display the always in two digits
15+
// day.innerHTML = toDay.getDay();
16+
day.innerHTML = weekDays[toDay.getDay()];
17+
18+
month.innerHTML =allMonths[toDay.getMonth()];
19+
20+
21+
year.innerHTML = toDay.getFullYear();

19. Mini Calendar/style.css

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
font-family: 'Poppins', sans-serif;
6+
}
7+
8+
body {
9+
display: flex;
10+
justify-content: center;
11+
align-items: center;
12+
height: 100vh;
13+
background-color: #ffffff;
14+
}
15+
16+
.container {
17+
display: flex;
18+
justify-content: center;
19+
align-items: center;
20+
height: 100%;
21+
}
22+
23+
.calendar {
24+
display: flex;
25+
justify-content: space-between;
26+
align-items: center;
27+
background-color: #e8b5b5ed;
28+
padding: 20px;
29+
border-radius: 10px;
30+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
31+
max-width: 400px;
32+
width: 100%;
33+
34+
}
35+
36+
.left,
37+
.right {
38+
text-align: center;
39+
margin-left: 10px;
40+
}
41+
42+
.right {
43+
margin-left: 50px;
44+
background-color: rgb(211, 71, 21);
45+
padding: 50px;
46+
margin: -19px;
47+
border-top-right-radius: 5px;
48+
border-bottom-right-radius: 5px;
49+
margin-left: 10px;
50+
51+
}
52+
53+
#date {
54+
font-size: 24px;
55+
font-weight: bold;
56+
}
57+
58+
#day {
59+
font-size: 18px;
60+
color: #5f5454;
61+
}
62+
63+
#month {
64+
font-size: 18px;
65+
font-weight: bold;
66+
}
67+
68+
#year {
69+
font-size: 18px;
70+
color: #888;
71+
}

0 commit comments

Comments
 (0)