Skip to content

Commit 62eb4a1

Browse files
committed
add simple counter
1 parent 07b6ca4 commit 62eb4a1

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

SimpleCounter/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 http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Simple Counter</title>
8+
<link rel="stylesheet" href="style.css" />
9+
</head>
10+
<body>
11+
<main>
12+
<h1>Simple Counter</h1>
13+
14+
<div class="counter">
15+
<button onclick="decrement()" class="btn">-</button>
16+
<input type="text" readonly="readonly" id="value" value="0" />
17+
<button onclick="increment()" class="btn">+</button>
18+
</div>
19+
20+
<button onclick="reset()" class="btn-reset">Reset</button>
21+
</main>
22+
<script src="index.js"></script>
23+
</body>
24+
</html>

SimpleCounter/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var number = document.getElementById("value");
2+
3+
function increment() {
4+
number.value++;
5+
}
6+
7+
function decrement() {
8+
number.value--;
9+
}
10+
11+
function reset() {
12+
number.value = 0;
13+
}

SimpleCounter/style.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
@import url("https://fonts.googleapis.com/css2?family=Roboto&display=swap");
2+
3+
body {
4+
display: flex;
5+
justify-content: center;
6+
font-family: "Roboto", sans-serif;
7+
background-color: #4158d0;
8+
background-image: linear-gradient(
9+
43deg,
10+
#4158d0 0%,
11+
#c850c0 46%,
12+
#ffcc70 100%
13+
);
14+
height: 100vh;
15+
}
16+
17+
main {
18+
display: flex;
19+
flex-direction: column;
20+
justify-content: center;
21+
align-items: center;
22+
width: 400px;
23+
height: 200px;
24+
background: rgba(255, 255, 255, 0.2);
25+
border-radius: 16px;
26+
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
27+
backdrop-filter: blur(0px);
28+
-webkit-backdrop-filter: blur(0px);
29+
border: 1px solid rgba(255, 255, 255, 0.3);
30+
}
31+
32+
h1 {
33+
margin: 10px 0;
34+
}
35+
36+
.btn-reset {
37+
margin-top: 20px;
38+
padding: 10px 20px;
39+
background: rgba(255, 255, 255, 0.2);
40+
border-radius: 5px;
41+
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
42+
backdrop-filter: blur(0px);
43+
-webkit-backdrop-filter: blur(0px);
44+
border: 1px solid rgba(255, 255, 255, 0.3);
45+
}
46+
47+
.btn,
48+
input {
49+
padding: 5px 10px;
50+
background: rgba(255, 255, 255, 0.2);
51+
border-radius: 5px;
52+
backdrop-filter: blur(0px);
53+
-webkit-backdrop-filter: blur(0px);
54+
border: 1px solid rgba(255, 255, 255, 0.3);
55+
}
56+
57+
input {
58+
width: 100px;
59+
}
60+
61+
.btn-reset:hover,
62+
.btn:hover {
63+
cursor: pointer;
64+
}

0 commit comments

Comments
 (0)