-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.html
113 lines (102 loc) · 2.87 KB
/
todo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.title {
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
color: rgb(64, 3, 3);
font-size: 55px;
text-align: center;
margin-top: 25px;
padding: 0;
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
margin-left: 30px;
}
body {
font-family: Arial, sans-serif;
background-color: #f27070;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#todo-container {
width: 300px;
text-align: center;
padding: 20px;
border-radius: 8px;
background-color: #ffffffc8;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
#dayInput{
font-family:'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
color: rgb(64, 3, 3);
padding: 0;
font-size: 35px;
font-weight: bolder;
background-color: #f27070;
border: 0;
}
#taskInput {
width: 70%;
padding: 8px;
margin-right: 5px;
border: 2px solid green;
border-radius: 4px;
}
button {
padding: 8px;
border: none;
background-color: #4caf50;
color: #fff;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #116e16;
}
.task {
margin: 10px 0;
padding: 0px;
border-radius: 4px;
cursor: pointer;
text-size-adjust: 30px;
}
</style>
</head>
<body>
<h1 class="title">To Do: <input id="dayInput" contenteditable="true" placeholder="Type date"></h1>
<div id="todo-container">
<input type="text" id="taskInput" placeholder="Type your task...">
<p style="font-size: 12px; font-style: italic; color: gray; padding: 0px; margin-bottom: 0px;">To add, press enter key</p>
<p style="font-size: 12px; font-style: italic; color: gray; margin-top: 3px;">To delete, press on task</p>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const input = document.getElementById("taskInput");
const todoContainer = document.getElementById("todo-container");
input.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
const taskText = input.value.trim();
if (taskText !== "") {
const taskElement = document.createElement("div");
taskElement.classList.add("task");
taskElement.textContent = taskText;
taskElement.addEventListener("click", function () {
taskElement.remove();
});
todoContainer.appendChild(taskElement);
input.value = "";
}
}
});
});
</script>
</body>
</html>