这是一份由原生JS写成的ToDoList代码,做的不一定完美,仅供参考。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
html,
body {
width: 100%;
height: 100%;
background: #ccc;
}
header {
height: 50px;
background: #251310;
position: relative;
}
li {
list-style: none;
}
h1 {
height: 50px;
font-size: 26px;
color: white;
text-align: center;
line-height: 50px;
margin: 0 auto;
}
h1 #input {
width: 200px;
height: 30px;
outline: none;
border: 0;
border-radius: 5px;
text-indent: 10px;
margin-left: 100px;
}
section {
font-size: 20px;
width: 450px;
margin: 0 auto;
position: relative;
}
footer {
font-size: 20px;
width: 450px;
margin: 0 auto;
position: relative;
}
.no {
display: none;
}
#delete {
display: inline-block;
width: 30px;
height: 15px;
font-size: 12px;
border-radius: 10px;
text-align: center;
background: #fff;
position: absolute;
cursor: pointer;
right: 0;
border: 6px double #cccccc
}
h2 {
height: 40px;
<