<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>My Simple App</title>
<style>
/* CSS: This makes it look like a modern app */
body { font-family: ‘Segoe UI’, sans-serif; background-color: #f0f2f5; display: flex; justify-content: center; padding: 20px; }
.app-container { background: white; width: 350px; border-radius: 20px; shadow: 0 10px 25px rgba(0,0,0,0.1); overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.header { background: #4A90E2; color: white; padding: 20px; text-align: center; }
.content { padding: 20px; }
.input-group { display: flex; gap: 10px; margin-bottom: 20px; }
input { flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 5px; }
button { padding: 10px; background: #4A90E2; color: white; border: none; border-radius: 5px; cursor: pointer; }
button:hover { background: #357ABD; }
ul { list-style: none; padding: 0; }
li { background: #f9f9f9; margin-bottom: 8px; padding: 10px; border-radius: 5px; display: flex; justify-content: space-between; border-left: 4px solid #4A90E2; }
</style>
</head>
<body>
<div class=”app-container”>
<div class=”header”>
<h2 id=”greeting”>Hello!</h2>
<p id=”date”></p>
</div>
<div class=”content”>
<h4>To-Do List</h4>
<div class=”input-group”>
<input type=”text” id=”taskInput” placeholder=”Add a new task…”>
<button onclick=”addTask()”>Add</button>
</div>
<ul id=”taskList”>
</ul>
</div>
</div>
<script>
// JavaScript: This makes the app “work”
// Set the date
const options = { weekday: ‘long’, month: ‘long’, day: ‘numeric’ };
document.getElementById(‘date’).innerHTML = new Date().toLocaleDateString(undefined, options);
// Add task function
function addTask() {
const input = document.getElementById(‘taskInput’);
const taskValue = input.value;
if (taskValue === ”) return;
const li = document.createElement(‘li’);
li.innerHTML = `${taskValue} <span style=”color:red; cursor:pointer” onclick=”this.parentElement.remove()”></span>`;
document.getElementById(‘taskList’).appendChild(li);
input.value = ”; // Clear input
}
</script>
</body>
</html>
Requirements:

Leave a Reply
You must be logged in to post a comment.