时间:2023-09-16 19:24:01 | 来源:网站运营
时间:2023-09-16 19:24:01 来源:网站运营
前端——CSS(2)以及京东购物车页面编写:body,div,h1,h2,h3,h4,h5,h6,li,ol,ul{margin: 0px;padding: 0px;}body{text-align: center;font-size: 14px;}a{text-decoration: none;}li{list-style: none;}
2.jd.css代码,这个css文件部分是对格式的编写,可以对照着下面展示的html文件进行对比,一个一个进行对照,来进行代码的理解。.nav{ height: 30px; background-color: #E3E4E5; }.warp{ width: 1000px; margin: 0px auto;}.nav_ul1,.nav_ul2 li{ float: left;}.nav_ul1 li{ float: left; line-height: 30px; margin-right: 20px;}.nav_ul1 a,.nav_ul2 a,.nav_ul2 span{ font-size: 12px; color: gray;}.nav_ul2{ float: right;}.nav_ul2 li,.nav_ul2 span{ line-height: 30px; margin-left: 15px;}.nav a:hover{ color: red;}.search{ margin-top: 20px;}.search img{ clear: both; float: left;}.search_div { float: right; margin-top: 25px;}.search_text{ width: 265px; height: 21px; border: 3px solid #c91623; position: relative; left: 4px; top: -1px;}.search_but{ width: 51px; height: 29px; background-color: #c91623; border: 0px; color: #FFFFFF;}.title{ margin-top: 130px;}.title h3{ float: left; font-size: 23px; color: #c91623;}.title div{ float: right; font-size: 14px; color: gray;}.tips{ width: 1000px; height: 50px; background-color: #F1F1F1; margin-top: 165px; border: 1px solid #E9E9E9;}.tips li{ float: left; line-height: 50px; font-size: 12px; color: gray;}.tips li:nth-child(1){width: 90px; border-top: 3px solid #c91623;}.tips li:nth-child(2){margin-left: 80px;}.tips li:nth-child(3){margin-left: 430px;}.tips li:nth-child(4){margin-left: 70px;}.tips li:nth-child(5){margin-left: 110px;}.tips li:nth-child(6){margin-left: 50px;}.info{ width: 1000px; height: 125px; background-color: #FFF4C8; border: 1px solid gray; margin-top: 30px; border-top: 3px solid gray;}.info li{ float: left; margin-top: 20px;}.info a{ font-size: 12px; color: #333333;}.info_1{ margin-left: 23px;}.info_2{ margin-left: 15px; border: 1px solid gray;}.info_3{ width: 250px; height: 20px;}.info_4{ margin-left: 40px;}.info_5{ margin-left: 70px;}.info_6{ margin-left: 40px;}.info_6 input{ width: 30px; height: 12px; text-align: center; position: relative; top: -2px; left: -5px;}.info_6 button{ width: 30px; height: 18px;}.bot{ position: relative; left: -10px;}.info_7{ margin-left: 60px;}.balance{ width: 1000px; height: 50px; border: 1px solid gray; margin-top: 30px;}.balance_ul1,.balance_ul1>li,.balance_ul2>li{ float: left; line-height: 50px; margin-left: 14px;}.balance_ul2{ float: right; }.butt{ width: 100px; height: 50px; background-color: #C91623; border: 0px; color: #FFFFFF; font-size: 20px; font-weight: bold;}.balance span{ font-size: 25px; color: #C91623; font-weight: bold;}.balance_ul2 li:nth-child(1){width: 120px;}.balance_ul2 li:nth-child(2){width: 150px;}
3.HTML文件:<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" type="text/css" href="css/reset.css"/> <link rel="stylesheet" type="text/css" href="css/jd.css"/> <link rel="stylesheet" type="text/css" href="icon/iconfont.css"/> </head> <body> <!--导航开始--> <div class="nav"> <div class="warp"> <ul class="nav_ul1"> <li><a href=""><i class="iconfont"></i>京东首页</a></li> <li><a href="">配送到:浙江</a></li> </ul> <ul class="nav_ul2"> <li><a href="">用户登录</a><span>|</span></li> <li><a href="">我的订单</a><span>|</span></li> <li><a href="">我的京东</a><span>|</span></li> <li><a href="">京东会员</a><span>|</span></li> <li><a href="">企业采购</a><span>|</span></li> <li><a href="">客户服务</a><span>|</span></li> <li><a href="">网站导航</a><span>|</span></li> <li><a href="">手机京东</a></li> </ul> </div> </div> <div class="search"> <div class="warp"> <img src="img/logo.jpg" /> <div class="search_div"> <input type="text" class="search_text" /> <input type="button" value="搜索" class="search_but" /> </div> </div> </div> <!--标题开始--> <div class="title warp"> <h3>全部商品</h3> <div> <span>配送至</span> <select> <option>杭州市</option> <option>焦作市</option> <option>开封市</option> <option>新乡市</option> </select> </div> </div> <div class="tips warp"> <ul> <li> <input type="checkbox" name="" id="" value="" /> 全选 </li> <li>商品</li> <li>单价</li> <li>数量</li> <li>小计</li> <li>操作</li> </ul> </div> <div class="info warp"> <ul> <li class="info_1"><input type="checkbox" /></li> <li class="info_2"><img src="img/img1.jpg" width="80px"/></li> <li class="info_3"><a>【京东超市】desha春秋季儿童休闲服</a></li> <li class="info_4"><a>颜色:灰色+粉红</a></li> <li class="info_5">¥182.5</li> <li class="info_6"> <button>-</button> <input type="text" name="" id="" value="1" /> <button class="bot">+</button> </li> <li class="info_7">¥182.5</li> <li> <a>删除</a><br /> <a>已到我的关注</a> </li> </ul> </div> <div class="info warp"> <ul> <li class="info_1"><input type="checkbox" /></li> <li class="info_2"><img src="img/img3.jpg" width="80px"/></li> <li class="info_3"><a>【京东超市】好孩子婴儿橄榄洗衣液</a></li> <li class="info_4"><a>颜色:灰色+粉红</a></li> <li class="info_5">¥82.5</li> <li class="info_6"> <button>-</button> <input type="text" name="" id="" value="1" /> <button class="bot">+</button> </li> <li class="info_7">¥82.5</li> <li> <a>删除</a><br /> <a>已到我的关注</a> </li> </ul> </div> <div class="info warp"> <ul> <li class="info_1"><input type="checkbox" /></li> <li class="info_2"><img src="img/img2.jpg" width="80px"/></li> <li class="info_3"><a>【京东超市】宏碁电脑,第六代智能英特尔</a></li> <li class="info_4"><a>颜色:深空灰</a></li> <li class="info_5">¥1882.5</li> <li class="info_6"> <button>-</button> <input type="text" name="" id="" value="1" /> <button class="bot">+</button> </li> <li class="info_7">¥1882.5</li> <li> <a>删除</a><br /> <a>已到我的关注</a> </li> </ul> </div> <div class="balance warp"> <ul class="balance_ul1"> <li> <input type="checkbox" name="" id="" value="" /> 全选 </li> <li><a>删除选中商品</a></li> <li><a>移到我的关注</a></li> <li><a>清除下柜商品</a></li> </ul> <ul class="balance_ul2"> <li>已选择1件商品</li> <li>总价<span>¥12</span></li> <li> <button class="butt">去结算</button> </li> </ul> </div> </body></html>
每一个div对应的有多个css文件中的格式,div中的class名和css中的名字是一一对应的,可能看起来比较乱,但是两个文件的信息都是从上到下对应起来的,所以仔细看还是比较有条理的。那么最终完成的成果就是最开始展示的图片了关键词:编写