編輯問題,以包括預期行為、特定問題或錯誤以及重現(xiàn)問題所需的最短代碼。這將有助于其他人回答問題。
#任務。任務選擇器將應用于class = & quot任務& quot這是id為& quot的元素的子元素任務& quot。例如:
<div id="tasks">
<div class="task"></div>
</div>
但是,這兩個元素都不存在于您的標記中。你確實有& ltdiv id = & quot任務& quot& gt,所以只需將選擇器更改為#task
:root {
--dark: #374151;
--darker: #1F2937;
---darkest: #111827;
--gray: #6B7280;
--light: #EEE;
--pink: #EC4899;
--purple: #8B5CF6;
}
* {
box-sizing: border-box;
margin:0;
font-family: 'Fire sans', sans-serif;
}
body {
display: flex;
flex-direction: column;
min-height:100vh;
background: var(--dark);
color: #FFF;
}
header {
padding: 2rem 1rem;
max-width: 800px;
width: 100%;
margin: 0 auto;
}
header h1{
font-size: 2.5rem;
font-weight: 300;
color: var(--gray);
margin-bottom: 1rem;
}
#new-task-form {
display: flex;
}
input, button {
appearance: none;
border: none;
outline: none;
background: none;
}
#new-task-input {
flex: 1 1 0%;
background-color: var(--darker);
padding: 1rem;
border-radius: 1rem;
margin-right: 1rem;
color: var(--light);
font-size: 1.25rem;
}
#new-task-input::placeholder {
color: var(--gray);
}
#new-task-submit {
color: var(--pink);
font-size: 1.25rem;
font-weight: 700;
background-image: linear-gradient(to right, var(--pink),
var(--purple));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
cursor: pointer;
transition: 0.4s;
}
#new-task-submit:hover {
opacity: 0.8;
}
#new-task-submit:active {
opacity: 0.6;
}
main {
flex: 1 1 0%;
max-width: 800px;
width: 100%;
margin: 0 auto;
}
.task-list {
padding: 1rem;
}
.task-list h2{
font-size: 1.5rem;
font-weight: 300;
color: var(--gray);
margin-bottom: 1rem;
}
#task {
display: flex;
justify-content: space-between;
background-color: var(--darkest);
padding: 1rem;
border-radius: 1rem;
margin-bottom: 1rem;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To Do List 2023</title>
<link rel="stylesheet" href="main.css" />
</head>
<body>
<header>
<h1>Task List 2023</h1>
<form id="new-task-form">
<input
type="text"
id="new-task-input"
placeholder="Are you ready?"/>
<input
type="submit"
id="new-task-submit"
value="Add task" />
</form>
</header>
<main>
<section class="task-list">
<h2>Tasks</h2>
<div id="task">
<div class="content">
<input
type="text"
class="text"
value="My shiny task"
readonly
/>
</div>
<div class="actions">
<button class="edit">Edit</button>
<button class="delete">Delete</button>
</div>
</section>
</main>
<script src="main.js"></script>
</body>
</html>
上一篇c 中拼接json字符串
下一篇python 腦電pca