《语言的魅力-备忘录打卡》

这篇博客展示了如何利用HTML、CSS和JavaScript创建一个备忘录式的待办事项打卡应用。代码中详细定义了样式和交互,包括背景渐变、元素布局、列表项的勾选效果等,实现了一个简洁而实用的每日任务管理界面。
摘要由CSDN通过智能技术生成

效果展示:

备忘录打卡效果展示

所用技术:

  • HTML
  • CSS
  • JavaScript

代码展示:

Html:

<!DOCTYPE html>
<html lang="en" >

<head>
<meta charset="UTF-8">
<title>100dayscss #27</title>
<link rel="stylesheet" href="css/style.css">
</head>

<body>

  <div class="frame">
  <div class="center">
		<section class="todo-cmp">
			<header class="todo-cmp__header">
				<h2 id="day"></h2>
				<p id="data"></p>
			</header>

				<ul class="todo-cmp__list">
					<li>
						<label for="todo-01">
							<input id="todo-01" type="checkbox">
							<span>打开模板</span>
						</label>
					</li>
					<li>
						<label for="todo-02">
							<input id="todo-02" type="checkbox">
							<span>创建待办事项列表</span>
						</label>
					</li>
						<li>
						<label for="todo-03">
							<input id="todo-03" type="checkbox">
							<span>写点什么</span>
						</label>
					</li>
					<li>
						<label for="todo-04">
							<input id="todo-04" type="checkbox">
							<span>完成任务</span>
						</label>
					</li>
			</ul>
		</section>
  </div>
</div>
<script src="js/base.js"></script>
</body>
</html>


Css:

@charset "UTF-8";
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600);
.frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  margin-top: -200px;
  margin-left: -200px;
  border-radius: 2px;
  box-shadow: 4px 8px 16px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  font-family: 'Open Sans', Helvetica, sans-serif;
  /* 抗锯齿,让文字更清晰 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
 
  background-image: linear-gradient(45deg, #ff9700, #ed1c24);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fda231', endColorstr='#fdca31',GradientType=1 );
}

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

.todo-cmp {
  background: #ffffff;
  color: #497081;
  padding: 10px 30px;
  border-radius: 5px;
  box-shadow: 2px 2px 14px rgba(0, 0, 0, 0.15);
  width: 180px;
}
.todo-cmp__header {
  text-align: center;
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
}
.todo-cmp__header h2 {
  font-weight: 600;
  font-size: 18px;
  margin: 4px auto;
  padding: 0;
}
.todo-cmp__header p {
  padding: 0 0 5px;
  margin: 4px auto;
  font-size: 0.8rem;
}
.todo-cmp__list {
  list-style: none;
  padding: 0;
}
.todo-cmp__list li {
  padding: 10px 0 15px;
  margin: 0;
  text-align: left;
  width: 100%;
}
.todo-cmp__list li label {
  cursor: pointer;
  font-size: 0.82rem;
  width: 100%;
  display: block;
}
.todo-cmp__list li label input {
  float: right;
  opacity: 0;
}
.todo-cmp__list li label span {
  position: relative;
  display: block;
  transition: all 550ms ease-in-out;
}
/* 兄弟选择器 */
.todo-cmp__list li label input + span::after {
  content: "";
  display: block;
  border: 1px solid #497081;
  border-radius: 13px;
  height: 13px;
  width: 13px;
  position: absolute;
  right: 0;
  top: 1px;
  z-index: 10;
  transition: all 550ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.todo-cmp__list li label input + span::before {
  content: "✔";
  display: block;
  font-size: 22px;
  height: 13px;
  width: 13px;
  position: absolute;
  right: -2px;
  top: -8px;
  z-index: 10;
  opacity: 0;
}
.todo-cmp__list li label input:checked + span {
  color: #ccc;
  transition: all 550ms ease-in-out;
}
.todo-cmp__list li label input:checked + span::after {
  opacity: 0;
  height: 17px;
  width: 17px;
  top: -2px;
  right: -2px;
}
.todo-cmp__list li label input:checked + span::before {
  opacity: 1;
  transition: all 550ms ease-in-out;
}

JavaScript:

var MyDate = new Date()
var years = MyDate.getFullYear()//获取当前年
var months = (MyDate.getMonth())+1//获取当前月
var date = MyDate.getDate()//获取当前日
var day = MyDate.getDay()//获取当前星期几
var days = ["日","一","二","三","四","五","六"]
var today_date = years+"年"+months+"月"+date+"日"
var today_day = "星期"+days[day]
document.getElementById("data").innerHTML = today_date
document.getElementById("day").innerText = today_day
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值