CSS-Todo-App 使用教程

CSS-Todo-App 使用教程

CSS-Todo-AppBasic todo app functionality without using JavaScript项目地址:https://gitcode.com/gh_mirrors/cs/CSS-Todo-App

1. 项目的目录结构及介绍

CSS-Todo-App/
├── index.html
├── style.css
├── script.js
└── images/
    ├── pencil.png
    ├── delete.png
    ├── plus.png
    └── notebook.gif
  • index.html: 项目的入口文件,包含HTML结构和页面布局。
  • style.css: 项目的样式文件,定义了页面的外观和布局。
  • script.js: 项目的脚本文件,包含了应用的逻辑和功能实现。
  • images/: 存放项目所需的图片资源。

2. 项目的启动文件介绍

index.html

index.html 是项目的启动文件,包含了基本的HTML结构和页面布局。以下是文件的主要内容:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Todo List App</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <div class="todo-header">
            <h2>ToDo List</h2>
            <img src="images/notebook.gif" height="50px" />
        </div>
        <div class="todo-body">
            <input type="text" id="todoText" class="todo-input" placeholder="Add your items" />
            <img src="images/plus.png" alt="+" id="AddUpdateClick" onclick="CreateToDoItems()" />
        </div>
        <ul id="listItems"></ul>
    </div>
    <script src="script.js"></script>
</body>
</html>

3. 项目的配置文件介绍

style.css

style.css 文件定义了页面的样式和布局。以下是文件的主要内容:

.container {
    width: 300px;
    margin: auto;
    text-align: center;
}

.todo-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-left: 5px;
    justify-content: center;
}

.todo-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #edeef0;
    border-radius: 30px;
    padding-left: 20px;
    margin-bottom: 25px;
}

.todo-body input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px;
}

.todo-controls {
    width: 25px;
    height: 25px;
    margin-right: 10px;
    cursor: pointer;
}

script.js

script.js 文件包含了应用的逻辑和功能实现。以下是文件的主要内容:

function CreateToDoItems() {
    const todoValue = document.getElementById("todoText");
    if (todoValue.value === "") {
        alert("Please enter a task");
        return;
    }
    const listItems = document.getElementById("listItems");
    const li = document.createElement("li");
    const todoItems = `<div title="Hit Double Click and Complete" ondblclick="CompletedToDoItems(this)">${todoValue.value}</div><div> <img class="edit todo-controls" onclick="UpdateToDoItems(this)" src="images/pencil.png" /> <img class="delete todo-controls" onclick="DeleteToDoItems(this)" src="images/delete.png" /></div></div>`;
    li.innerHTML = todoItems;
    listItems.appendChild(li);
    todoValue.value = "";
    setAlertMessage("Todo item Created Successfully ");
}

function setAlertMessage(message) {
    alert(message);
}

以上是 CSS-Todo-App 项目的使用教程,包含了项目的目录结构、启动文件和配置文件的介绍

CSS-Todo-AppBasic todo app functionality without using JavaScript项目地址:https://gitcode.com/gh_mirrors/cs/CSS-Todo-App

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

诸余煦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值