File tree Expand file tree Collapse file tree 3 files changed +76
-0
lines changed
Simple-Div-Flex/Simple Todo List Expand file tree Collapse file tree 3 files changed +76
-0
lines changed Original file line number Diff line number Diff line change
1
+ body {
2
+ font-family : Arial, sans-serif;
3
+ display : flex;
4
+ justify-content : center;
5
+ align-items : center;
6
+ height : 100vh ;
7
+ background-color : # ddff ;
8
+ }
9
+ .container {
10
+ background : white;
11
+ padding : 20px ;
12
+ border-radius : 10px ;
13
+ box-shadow : 0 0 10px rgba (0 , 0 , 0 , 0.1 );
14
+ width : 300px ;
15
+ text-align : center;
16
+ }
17
+ input {
18
+ width : 80% ;
19
+ padding : 8px ;
20
+ }
21
+ button {
22
+ padding : 8px ;
23
+ cursor : pointer;
24
+ margin-top : 10px ;
25
+ }
26
+ button {
27
+ padding : 8px ;
28
+ cursor : pointer;
29
+ margin-top : 10px ;
30
+ }
31
+ ul {
32
+ list-style : none;
33
+ padding : 0 ;
34
+ }
35
+ li {
36
+ background : # ddd ;
37
+ margin : 5px 0 ;
38
+ padding : 8px ;
39
+ display : flex;
40
+ justify-content : space-between;
41
+ }
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
+ < title > Task Management App</ title >
7
+ < link rel ="stylesheet " href ="index.css ">
8
+ </ head >
9
+ < body >
10
+ < div class ="container ">
11
+ < h2 > Task Management App</ h2 >
12
+ < input type ="text " id ="task " placeholder ="Add a new task ">
13
+ <!-- <input type="text" id="task" placeholder="Create a new task"> -->
14
+ < button onclick ="addTask() "> Add</ button >
15
+ < button onclick ="completeTask() "> Complete</ button >
16
+ < button onclick ="incompleteTask() "> Incomplete</ button >
17
+ < ul id ="taskList "> </ ul >
18
+ </ div >
19
+ < script src ="index.js "> </ script >
20
+ </ body >
21
+ </ html >
Original file line number Diff line number Diff line change
1
+ function addTask ( ) {
2
+ let taskInput = document . getElementById ( "task" ) ;
3
+ let taskValue = taskInput . value . trim ( ) ;
4
+ if ( taskValue === "" ) return ;
5
+
6
+ let li = document . createElement ( "li" ) ;
7
+ li . innerHTML = `${ taskValue } <button onclick="removeTask(this)">X</button>` ;
8
+ document . getElementById ( "taskList" ) . appendChild ( li ) ;
9
+ taskInput . value = "" ;
10
+ }
11
+
12
+ function removeTask ( btn ) {
13
+ btn . parentElement . remove ( ) ;
14
+ }
You can’t perform that action at this time.
0 commit comments