-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabout.html
More file actions
106 lines (101 loc) · 2.28 KB
/
about.html
File metadata and controls
106 lines (101 loc) · 2.28 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>To-Do List App</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f3f4f6;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background: #fff;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 10px rgba(0,0,0,0.1);
width: 350px;
}
h1 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
input {
width: 70%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 8px;
}
button {
padding: 10px;
margin-left: 5px;
border: none;
border-radius: 8px;
cursor: pointer;
}
.add-btn {
background: #4CAF50;
color: white;
}
ul {
list-style: none;
padding: 0;
margin-top: 15px;
}
li {
background: #f9fafb;
padding: 10px;
margin: 5px 0;
border-radius: 8px;
display: flex;
justify-content: space-between;
align-items: center;
}
li.done {
text-decoration: line-through;
color: gray;
}
.del-btn {
background: red;
color: white;
padding: 5px 8px;
border-radius: 6px;
}
</style>
</head>
<body>
<div class="container">
<h1>📝 To-Do List</h1>
<div>
<input type="text" id="taskInput" placeholder="Enter new task...">
<button class="add-btn" onclick="addTask()">Add</button>
</div>
<ul id="taskList"></ul>
</div>
<script>
const taskInput = document.getElementById("taskInput");
const taskList = document.getElementById("taskList");
function addTask() {
const taskText = taskInput.value.trim();
if (taskText === "") return alert("Please enter a task!");
const li = document.createElement("li");
li.innerHTML = `
<span onclick="toggleDone(this)">${taskText}</span>
<button class="del-btn" onclick="deleteTask(this)">X</button>
`;
taskList.appendChild(li);
taskInput.value = "";
}
function deleteTask(button) {
button.parentElement.remove();
}
function toggleDone(task) {
task.parentElement.classList.toggle("done");
}
</script>
</body>
</html>