Web前端开发项目(记忆卡片)

本文介绍如何使用HTML、CSS3和JavaScript创建一个动态记忆卡片项目,涉及DOM操作、事件处理和localStorage存储。项目包括创建项目目录、添加删除图标、构建HTML结构、编写样式和主要函数,实现卡片翻转、页面跳转和数据存储等功能。
摘要由CSDN通过智能技术生成

Web前端开发项目(记忆卡片)


前言

用html+css3+js制作一个可以动态添加卡片的记忆卡片网页,其中需熟练掌握Dom操作,window,innerText等


最终效果如下图
在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述

一、创建项目目录

在项目文件夹内创建index.html / style.css / script.js 文件,打开index.html,生产网页模板,更改网页标题。
将样式表style.css 和script.js 链接到index.html 中。
在这里插入图片描述
访问jsdelivr.com,搜索font-awesome ,找到并选中需要用到的css 文件,生成CDN 链接,并将生成的 复制到网页中。
在这里插入图片描述

二、创建添加图标和删除图标

1.添加+图标,来表示添加卡片

代码如下:

<div class="header">
      <h2>Memory card</h2>
      <button class="create">
      		<i class="fas fa-plus"></i>add card
      </button>
</div>

2.添加垃圾桶图标,来表示删除卡片

代码如下:

<button class="clear">
        <span ><i class="fas fa-trash"></i>Delete card</span>
</button>

三、构架HTML结构

代码如下:

<body>
    <!-- the icon of the add -->
    <div class="header">
      <h2>Memory card</h2>
      <button class="create" ><i class="fas fa-plus"></i>add card</button>
    </div>
    
    <div class="footer">
    <!-- the card of the control structure -->
      <div class="pageNums-box">
      	<!-- the icon of the turn to prev card  -->
        <button class="btn">
          <span class="prevCardToView" ><i class="fas fa-arrow-left"></i></span>
        </button>
       
        <span id="pageNums"></span>
         <!-- the icon of the turn to next card  -->
        <button class="btn">
          <span
  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Program中

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

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

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

打赏作者

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

抵扣说明:

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

余额充值