Skip to content

Commit

Permalink
Deleted past commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jomon joy committed Aug 10, 2024
0 parents commit a08561a
Show file tree
Hide file tree
Showing 5 changed files with 266 additions and 0 deletions.
Binary file added Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Digital Clock
![Project image](https://github.com/Jomonh/Digital-Clock/blob/main/Preview.png)

#### Live <a href="https://jomonh.github.io/Digital-Clock/">here</a>
## Getting started

To clone this repository, run this in your command prompt/Terminal

```bash
git clone https://github.com/Jomonh/Digital-Clock.git
```
and that's all you need to get started!
36 changes: 36 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digital Clock</title>
<link rel="stylesheet" href="style.css">


</head>
<body>
<div class="containerr">
<div class="container">
<div class="clock">
<span id="hrs">00</span>
<span>:</span>
<span id="min">00</span>
<span>:</span>
<span id="sec">00</span>
</div>
</div>

<div class="date">
<div class="top">
<p id="date">01</p>
<p id="day">Sunday</p>
<p id="month">January</p>
<p id="year">2020</p>
</div>
</div>
</div>
</body>

<script src="./script.js"></script>

</html>
49 changes: 49 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
let hrs = document.getElementById("hrs");
let min = document.getElementById("min");
let sec = document.getElementById("sec");

setInterval(() => {
let currentTime = new Date();
hrs.innerHTML =
(currentTime.getHours() < 10 ? "0" : "") + currentTime.getHours();
min.innerHTML =
(currentTime.getMinutes() < 10 ? "0" : "") + currentTime.getMinutes();
sec.innerHTML =
(currentTime.getSeconds() < 10 ? "0" : "") + currentTime.getSeconds();
}, 1000);

const date = document.getElementById("date");
const day = document.getElementById("day");
const month = document.getElementById("month");
const year = document.getElementById("year");

const today = new Date();

const weekDays = [
"Sunday ,",
"Monday ,",
"Tuesday ,",
"Wednesday ,",
"Thursday ,",
"Friday ,",
"Saturday ,",
];
const allMonths = [
" January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];

date.innerHTML = (today.getDate() < 10 ? "0" : " ") + today.getDate();
day.innerHTML = weekDays[today.getDay()];
month.innerHTML = allMonths[today.getMonth()];
year.innerHTML = today.getFullYear();
169 changes: 169 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
*{
margin: 0;
padding: 0;
font-family: 'Poppins',sans-serif;
box-sizing: border-box;
}
.containerr{
width: 100%;
min-height: 100vh;
background-color: #000;
color: #ffffff;
}
.container{
width: 800px;
height: 180px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.clock{
width: 100%;
height: 100%;
background: rgba(234, 0, 255, 0.252);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(70px);
}
.container::before{
content: '';
width: 180px;
height: 180px;
background: #f41b75;
border-radius: 5px;
position: absolute;
left: -50px;
top: -50px;
z-index: -1;
}
.container::after{
content: '';
width: 180px;
height: 180px;
background: #419aff;
border-radius: 50%;
position: absolute;
right: -50px;
bottom: -50px;
z-index: -1;
}
.clock span{
font-size: 80px;
width: 110px;
display: inline-block;
text-align: center;
position: relative;
}
.clock span::after{
font-size: 16px;
position: absolute;
bottom: -10px;
left: 50%;
transform: translateX(-50%);
}
#hrs::after{
content: 'HOURS';
}
#min::after{
content: 'MINS';
}
#sec::after{
content: 'SEC';
}

/* Date */

.date{
width: 100%;
height: 10vh;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.top{
position: relative;
display: flex;
flex-direction: row;
gap: 5px;
top: 100%;
background: rgba(234, 0, 255, 0.252);
padding: 10px 20px;
border-radius: 5px;
backdrop-filter: blur(80px);
}
@media only screen and (max-width:1200px){
.container{
width: 500px;
height: 140px;
}
.container::before{
width: 140px;
height: 140px;
margin-left: 15px;
}
.container::after{
width: 140px;
height: 140px;
margin-left: 15px;
}

}
@media only screen and (max-width:600px){
.container{
width: 300px;
height: 120px;
}
.container::before{
width: 120px;
height: 120px;
margin-left: 15px;
}
.container::after{
width: 120px;
height: 120px;
margin-right: 15px;
}
.clock span{
font-size: 55px;
width: 50px;
}
.clock span::after{
font-size: 12px;
left: 70%;
}


}

@media only screen and (max-width:450px){
.container{
width: 250px;
height: 100px;
}
.container::before{
width: 100px;
height: 100px;
margin-left: 15px;
}
.container::after{
width: 100px;
height: 100px;
margin-right: 15px;
}
.clock span{
font-size: 35px;
width: 50px;
}
.clock span::after{
font-size: 10px;
left: 60%;
}


}


0 comments on commit a08561a

Please sign in to comment.