JSFiddle - React, Tailwind, and code Playground
HTML
<!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>Document</title>
</head>
<body>
<div class="wrap">
<div class="item">
<input type="text" id="content">
<button onclick="addNew()">Add</button>
</div>
</div>
<div class="wrap wrap_task">
<h1>代辦清單</h1>
<ul id="task"></ul>
</div>
</body>
</html>
CSS
*{
padding:0px;
margin:0px;
box-sizing:border-box;
}
span{
font-size:30px;
font-size:600;
color:#6A381F;
}
html,body{
width:100%;
height:100%;
background-color:#6E0D25;
}
.wrap{
background-color:#FFFFB3;
padding:2rem;
margin:2rem;
display:flex;
justify-content:center;
border-radius:20px;
}
.wrap_task{
flex-direction:column;
align-items:center;
}
JavaScript
function addNew(){
let content = document.getElementById("content").value;
let ul = document.getElementById("task");
let li = document.createElement("li");
let sp = document.createElement("span");
ul.appendChild(li).appendChild(sp).append(content);
}