<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lista de Tarefas</title>
<link rel="stylesheet" href="
styles.css">
</head>
<body>
<div class="container">
<h1>Lista de Tarefas</h1>
<form id="task-form">
<input type="text" id="new-task" placeholder="Adicione uma nova tarefa..." Required>
<button type="submit">Adicionar</button>
</form>
<ul id="task-list"></ul>
</div>
<script src="
script.js"></script>
</body>
</html> body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: white;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
h1 {
text-align: center;
color: #333;
}
form {
display: flex;
margin-bottom: 20px;
}
form input {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
border-radius: 3px;
}
form button {
padding: 10px;
border: none;
background: #4CAF50;
color: white;
cursor: pointer;
border-radius: 3px;
margin-left: 10px;
}
form button:hover {
background: #45a049;
}
ul {
list-style: none;
padding: 0;
}
ul li {
background: #f9f9f9;
margin: 5px 0;
padding: 10px;
border: 1px solid #ddd;
border-radius: 3px;
display: flex;
justify-content: space-between;
align-items: center;
}
ul li.completed {
text-decoration: line-through;
color: #999;
}
ul li button {
background: #ff6347;
border: none;
color: white;
cursor: pointer;
border-radius: 3px;
padding: 5px 10px;
}
ul li button:hover {
background: #ff4500;
} document.addEventListener('DOMContentLoaded', () => {
const taskForm = document.getElementById('task-form');
const newTaskInput = document.getElementById('new-task');
const taskList = document.getElementById('task-list');
taskForm.addEventListener('submit', (e) => {
e.preventDefault();
addTask(
newTaskInput.value);
newTaskInput.value = '';
});
function addTask(task) {
const li = document.createElement('li');
li.textContent = task;
const completeButton = document.createElement('button');
completeButton.textContent = 'Concluir';
completeButton.addEventListener('click', () => {
li.classList.toggle('completed');
});
const deleteButton = document.createElement('button');
deleteButton.textContent = 'Excluir';
deleteButton.addEventListener('click', () => {
li.remove();
});
li.appendChild(completeButton);
li.appendChild(deleteButton);
taskList.appendChild(li);
}
});
Vamos criar um projeto simples de "To-Do List" (Lista de Tarefas) usando html, css e javascript. Este projeto permitirá que os usuários adicionem, removam e marquem tarefas como concluídas.
##
Delivery term: Not specified