-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtask1_letsgrowmore.html
More file actions
120 lines (106 loc) · 3.19 KB
/
Copy pathtask1_letsgrowmore.html
File metadata and controls
120 lines (106 loc) · 3.19 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: 'Arial', sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background-color: #f8f9fa;
}
.todo-container {
background-color: #fff;
border: 1px solid #dee2e6;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 400px;
width: 100%;
box-sizing: border-box;
overflow: hidden;
}
.header {
background-color: #343a40;
color: white;
padding: 10px;
text-align: center;
font-size: 1.5em;
}
.todo-list {
list-style-type: none;
padding: 0;
margin: 0;
}
.todo-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border-bottom: 1px solid #dee2e6;
font-size: 1.2em;
}
.todo-item input {
margin-right: 10px;
}
.add-todo {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
}
.add-todo input {
flex-grow: 1;
padding: 8px;
border: 1px solid #dee2e6;
border-radius: 4px;
margin-right: 10px;
}
.add-todo button {
background-color: #28a745;
color: white;
padding: 8px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.add-todo button:hover {
background-color: #218838;
}
</style>
<title>ToDo List</title>
</head>
<body>
<div class="todo-container">
<div class="header">ToDo List</div>
<ul class="todo-list" id="todoList"></ul>
<div class="add-todo">
<input type="text" id="newTodo" placeholder="Add a new task...">
<button onclick="addTodo()">Add</button>
</div>
</div>
<script>
function addTodo() {
const todoList = document.getElementById('todoList');
const newTodoInput = document.getElementById('newTodo');
if (newTodoInput.value.trim() === '') return;
const li = document.createElement('li');
li.classList.add('todo-item');
li.innerHTML = `
<input type="checkbox">
<span>${newTodoInput.value}</span>
<button onclick="removeTodo(this)">Delete</button>
`;
todoList.appendChild(li);
newTodoInput.value = '';
}
function removeTodo(button) {
const todoItem = button.parentElement;
todoItem.remove();
}
</script>
</body>
</html>