Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasiq-Tariq11 authored Oct 2, 2024
1 parent b69a98b commit 461a122
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
26 changes: 26 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-Do List App</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>My To-Do List</h1>
<div class="input-container">
<input type="text" id="task-input" placeholder="Add a new task...">
<button id="add-task">Add</button>
</div>

<ul id="task-list"></ul>

<footer>
Designed and Developed by Wasiq Tariq
</footer>
</div>

<script src="script.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.getElementById('add-task').addEventListener('click', function() {
const taskInput = document.getElementById('task-input');
const taskValue = taskInput.value.trim();

if (taskValue) {
const taskList = document.getElementById('task-list');
const listItem = document.createElement('li');
listItem.textContent = taskValue;

// Add delete button
const deleteBtn = document.createElement('button');
deleteBtn.textContent = 'Delete';
deleteBtn.onclick = function() {
taskList.removeChild(listItem);
};

listItem.appendChild(deleteBtn);
taskList.appendChild(listItem);
taskInput.value = ''; // Clear the input
} else {
alert('Please enter a task!');
}
});
98 changes: 98 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
* {
box-sizing: border-box;
}

body {
font-family: Arial, sans-serif;
background-image: url('https://images.unsplash.com/photo-1506748686214-e9df14d4d9d0?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&q=80&w=1920'); /* Full HD image */
background-size: cover; /* Ensures the image covers the entire background */
background-position: center; /* Centers the image */
margin: 0;
padding: 0;
}

.container {
max-width: 500px;
margin: 50px auto;
background: rgba(255, 255, 255, 0.9); /* Semi-transparent background */
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

h1 {
text-align: center;
color: #333;
}

.input-container {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
}

input {
flex: 1;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}

button {
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-left: 10px;
transition: background-color 0.3s;
}

button:hover {
background-color: #0056b3;
}

ul {
list-style: none;
padding: 0;
}

li {
padding: 15px;
border-bottom: 1px solid #ddd;
display: flex;
justify-content: space-between;
align-items: center;
}

li button {
background-color: #dc3545;
}

li button:hover {
background-color: #c82333;
}

footer {
text-align: center;
margin-top: 20px;
font-size: 14px;
color: #777;
}

@media (max-width: 600px) {
.input-container {
flex-direction: column;
}

input {
margin-bottom: 10px;
}

button {
width: 100%;
}
}

0 comments on commit 461a122

Please sign in to comment.