💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 细节完善 ### 1.引入normolize.css HTML标签的默认样式通常带着默认的边距等样式,在开发中我们经常需要手动重置标签的边框等属性。 我们选择`normalize.css`标准化样式库,来使得项目中的网页默认样式更加标准。 相比`reset.css`的激进,`normalize.css`对网页的初始化更加合理。 ~~~html <link href="https://cdn.bootcss.com/normalize/7.0.0/normalize.css" rel="stylesheet"/> ~~~ ### 1.添加HTML ~~~html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <link href="https://cdn.bootcss.com/normalize/7.0.0/normalize.css" rel="stylesheet"/> <link rel="stylesheet" type="text/css" href="css/base.css"/> </head> <body> <!--总容器开始--> <div class="container"> <h1>我的ToDo</h1> <form class="add-task"> <!--输入框--> <input name="content" type="text" placeholder="下午记得要买菜。。。"/> <!--添加按钮--> <button type="submit">submit</button> </form> <div class="task-list"> <div class="task-item"> <span><input type="checkbox"/></span> <span class="task-content">item content</span> <span>delete</span> <span>detail</span> </div> <div class="task-item"> <span><input type="checkbox"/></span> <span class="task-content">item content</span> <span>delete</span> <span>detail</span> </div> <div class="task-item"> <span><input type="checkbox"/></span> <span class="task-content">item content</span> <span>delete</span> <span>detail</span> </div> <div class="task-item"> <span><input type="checkbox"/></span> <span class="task-content">item content</span> <span>delete</span> <span>detail</span> </div> </div> <!--任务详情开始--> <div class="task-detail-mask"></div> <div class="task-detail"> <div class="content"></div> <div> <div class="desc"> <textarea name="" rows="" cols=""></textarea> </div> </div> <div class="remind"> <input type="date"/> <!--<button type="submit">submit</button>--> </div> </div> <!--容器结束--> </div> <script type="text/javascript" src="js/jquery.js" ></script> <script type="text/javascript" src="js/store.legacy.min.js" ></script> <script type="text/javascript" src="js/base.js" ></script> </body> </html> ~~~ ### 2.添加样式 [前置内容:box-sizing](http://www.jianshu.com/p/e2eb0d8c9de6) ~~~javascript * { /*background: rgba(0,0,0,0.1);*/ -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; } body{ background: #00334b; color: #fff; } .container{ max-width: 700px; margin: 0 auto; position:relative; } h1{ text-align: center; } input,.task-item,button,textarea{ border-radius: 3px; padding: 10px; } button{ display: inline-block; cursor:pointer; border: none; } input[type=text],input[type=date]{ border: none; display: block; width: 100%; background:#ddd ; } input[type=text]:hover, input[type=date]:hover, input[type=text]:focus, input[type=date]:focus{ background: #fff; } .add-task input[type=text]{ float: left; width: 84%; margin-right: 1%; } /*添加按钮*/ .add-task [type = submit]{ background: #46b1e4; width: 15%; } .task-list{ margin: 10px 0; } .task-item{ padding: 10px; background: #fff; color: #333; margin-bottom: 2px; border-radius: 3px; -webkit-box-shadow: 0 2px 3px rgba(0,0,0,0.4); -moz-box-shadow:0 2px 3px rgba(0,0,0,0.4); box-shadow: 0 2px 3px rgba(0,0,0,0.4); /*鼠标滑过显示小手*/ cursor: pointer; transition: background 0.3s; } .task-item:hover{ background: #ddd; } /*任务详情开始*/ .task-detail,.task-detail-mask{ position: absolute; } .task-detail{ background: #fff; color: #333; width: 50%; height: 100%; padding: 10px; bottom: 0; right: 0; /*一开始不显示*/ /*display: none;*/ } .task-detail-mask{ top:0; bottom: 0; right: 0; left: 0; background: rgba(30,30,30,0.7); /*一开始不显示*/ /*display: none;*/ } textarea, button, input[type=text], input[type=date]{ border: 0; } textarea{ width: 100%; min-height: 100px; display: block; box-shadow: inset 2px 3px rgba(0,0,0,0.4); margin-bottom: 5px; background:#ddd ; } textarea:focus,textarea:hover{ background: #FFFFFF; /*-webkit-box-shadow: 0 2px 3px rgba(0,0,0,0.4); -moz-box-shadow:0 2px 3px rgba(0,0,0,0.4);*/ } ~~~