练习(二) 仿京东(上) html+css

本次是跟着视频仿的京东头部
效果图:
在这里插入图片描述
html代码:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css" href="../css/base.css"/>
		<link rel="stylesheet" type="text/css" href="../css/normalize.css"/>
		<link rel="stylesheet" type="text/css" href="../css/icon.css"/>
		<title>京东</title>
	</head>
	<body>
		<!-- header 部分 start -->
		<header>
			<div class="w">
				<a href="#">
					<img src="../images/header.png">
				</a>
				<div class="hide-header">
					<span class="icon-cross"></span>
				</div>
			</div>
		</header>
		<!-- header 部分 end -->
		<!-- 导航栏部分 start -->
		<div class="shortcut">
			<div class="w">
				<ul class="fl area">
					<li><span class="icon-location red"></span><a href="#"> 广西</a></li>
				</ul>
				<ul class="fr">
					<li>
						<a href="#">你好,请登录</a>
						<a href="#" class="red">免费注册</a>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">我的订单</a>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">我的京东</a>
						<span class="icon-ctrl"></span>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">京东会员</a>
					</li>
					<li class="space"></li>
					<li>
						<a href="#" class="red">企业采购</a>
						<span class="icon-ctrl"></span>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">客户服务</a>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">网站导航</a>
						<span class="icon-ctrl"></span>
					</li>
					<li class="space"></li>
					<li>
						<a href="#">手机京东</a>
					</li>
				</ul>
			</div>
		</div>
	    <!-- 导航栏部分 end -->
		<!-- 中间头部分 start -->
		<div class="middle">
			<div class="w">
				<!-- logo -->
				<div class="logo">
					<h1>    
						<a href="#"></a>
					</h1>
				</div>
				<!-- 搜索 -->
				<div class="form">
					<input type="text" placeholder="电动滑板车">
					<span class="icon-camera"></span>
					<button><span class="icon-search"></span></button>
				</div>
				<!-- 购物车 -->
				<div class="shop-car">
					<span class="icon-cart"></span>
					<span class="car-goods">0</span>
					<a href="#">我的购物车</a>
				</div>
				<!-- 关键词 -->
				<div class="hot-words">
					<a href="#" class="red">沙龙洗发水</a>
					<a href="#">全球美妆</a>
					<a href="#">仙女同款</a>
					<a href="#">大屏电视</a>
					<a href="#">羊肉</a>
					<a href="#">爆款直降</a>
					<a href="#">每100-50</a>
					<a href="#">羽绒焕新</a>
					<a href="#">iphone11</a>
				</div>
				<!-- 小导航部分 -->
				<div class="navitems">
					<ul>
						<li><a href="#">秒杀</a></li>
						<li><a href="#">优惠券</a></li>
						<li><a href="#">PLUS会员</a></li>
						<li><a href="#">品牌闪购</a></li>
						<li><a href="#">拍卖</a></li>
						<li><a href="#">京东时尚</a></li>
						<li><a href="#">京东超市</a></li>
						<li><a href="#">京东生鲜</a></li>
						<li><a href="#">海囤全球</a></li>
						<li><a href="#">京东金融</a></li>
					</ul>
				</div>
				<!-- 推广位 -->
				<div class="treasure">
					<a href="#"></a>
				</div>
			</div>
		</div>
		<!-- 中间头部分 end -->
	</body>
</html>

css代码:

.w {
	width: 1190px;
	margin: 0 auto;
}
.fl {
	float: left;
}
.fr {
	float: right;
}
.red {
	color: #f10216;
}
ul {
	list-style: none;
}
a {
	text-decoration: none;
	color: #9e9e9e;
}
a:hover {
	color: #f10216;
}
body {
	background-color: #f4f4f4;
}
ul,h1,input,button {
	margin: 0px;
	padding: 0px;
}
input,button {
	border: 0;
	outline: none;
}



/* header 部分 */
header {
	height: 80px;
	background-color: #2f0d1d;
}
header .w {
	position: relative;
}
header img {
	height: 80px;
	width: 1190px;
}
.hide-header {
	height: 20px;
	width: 20px;
	font-size: 14px;
	color: rgba(255,255,255,.3);
	line-height: 20px;
	text-align: center;
	background-color: rgba(0,0,0,.3);
	position: absolute;
	top: 7px;
	right: 7px;	
}

/* 导航栏部分 */
.shortcut {
	height: 30px;
	color: #9e9e9e;
	font-size: 12px;
	line-height: 30px;
	background-color: #e3e4e5;
	border-bottom: 1px solid #dedede;
}
.area {
	margin-left: 10px;
}
.shortcut .fr {
	margin-right: 12px;
}
.shortcut li {
	float: left;
}
.space {
	width: 1px;
	height: 10px;
	background-color: #cacaca;
	margin: 11px ;
}




/* 中间头部分 */
/* logo */
.middle {
	height: 140px;
	background-color: #ffffff;
	border-bottom: 1px solid #e4e4e4;
} 
.middle .w {
	position: relative;
}
.logo a {
	display: block;
	width: 190px;
	height: 140px;
	background: url(../images/logo.png) no-repeat;
	position: absolute;
}

/* 搜索 */
.form {
	width: 550px;
	height: 36px;
	background-color: #F10216;
	position: absolute;
	top: 25px;
	left: 260px;    
}
.form input {
	width: 419px;
	height: 32px;
	padding: 0 17px;
	font-size: 12px;
	color: #444;
	border: 2px solid #e1251b;
	border-right: none;
	float: left;
}
.form .icon-camera {
	display: inline-block;
	width: 35px;
	height: 32px;
	color: #bcbcbc;
	line-height: 32px;
	background-color: #fff;
	border: 2px solid #E1251B;
	border-left: none;
	float: left;
}
.form .icon-camera:hover {
	color: #E1251B;
}
.form button {
	width: 58px;
	height: 36px;
	color: #fff;
	background-color: #E1251B;
	float: left;
}

/* 购物车 */
.shop-car {
	width: 130px;
	height: 34px;
	line-height: 34px;
	font-size: 12px;
	color: #E1251B;
	text-align: center;
	border: 1px solid #f2f2f2;
	position: absolute;
	top: 25px;
	right: 230px;
}
.shop-car .icon-cart {
	font-size: 14px;
	margin-right: 18px;
}
.car-goods {
	width: 18px;
	height: 13px;
	color: #fff;
	line-height: 14px;
	background-color: #E1251B;
	border-radius: 40%;
	position: absolute;
	top: 1px;
	left: 25px;
}
.shop-car a {
	color: #E1251B;
}

/* 关键词*/
.hot-words {
	font-size: 12px;
	position: absolute;
	top: 68px;
	left: 260px;
}
.hot-words a {
	margin-right: 8px;
}

/* 小导航栏 */
.navitems {
	width: 770px;
	height: 40px;
	line-height: 40px;
	position: absolute;
	padding-left: 12px;
	left: 200px;
	top: 100px;
}
.navitems li {
	float: left;
	margin-right: 22px;
}
.navitems li a {
	font-size: 15px;
	color: #474747;
}
.navitems li:nth-child(-n+2) a {
	font-weight: 700;
	color: #E1251B;
}
.navitems li a:hover {
	color: #E1251B;
}

/* 推广位 */
.treasure a{
	display: block;
	width: 190px;
	height: 140px;
	background: url(../images/treasure.png) no-repeat;
	position: absolute;
	right: 0;
}
  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值