css+html仿照小米商城

举报
秋名山码民 发表于 2022/08/31 15:44:02 2022/08/31
【摘要】 简介:这是一个仅用css+html实现的页面,不过页面也用css实现了一些精致的动态效果,比如老版本小米官网的logo滑动效果小米的二维码和购物车,导航栏延时下拉效果<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>小米商城</title> <link rel="stylesheet" href="clear.css...

简介:

这是一个仅用css+html实现的页面,不过页面也用css实现了一些精致的动态效果,比如

  1. 老版本小米官网的logo滑动效果
  2. 小米的二维码和购物车,导航栏延时下拉效果
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>小米商城</title>
		<link rel="stylesheet" href="clear.css">
		<link rel="stylesheet" href="one.css">
		<!-- 字体图标 -->
		<link rel="stylesheet" href="./iconfont/iconfont.css">
		<link rel="stylesheet" href="all.css">
		<!-- 网页图标 -->
		<link rel="icon" href="mi.ico">
		
	</head>
	<body>
		<!-- 頂部導航條 -->
		<div class="topbar-wrapper">
			<!-- 内部容器 -->
			<!-- 左侧导航 -->
			<div class="topbar w">
				<ul class="service">
					<li>
						<a href="#">小米商場</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">MIUI</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">lOT</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">雲服務</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">金融</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">有品</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">小愛開發平台</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">企業團購</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">資質證照</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">協議規則</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a  class="app" href="#">下載app
						<div class="qrcode">
							<img src="./小米二维码.jpg" alt="">
							<br />
							<span>小米商城app</span>
						</div>
						</a>
					</li>
					<li class="line"> | </li>
					<li>
						<a href="#">選擇你的地理位置</a>
					</li>
				</ul>
			<!-- 购物车 -->
			<ul class="show-car">
				<li><a href="#">
				<i class="iconfont">&#xe601;</i>
				购物車(0)</a></li>
				<li class="ts">
					购物车中还没有商品,赶快选购吧。
				</li>
			</ul>
			<!-- 用户登录注册 -->
			<ul class="user-info">
				<li>
					<a href="#">消息通知</a>
				</li>
				<li class="line">|</li>
				<li>
					<a href="#">注冊</a>
				</li>
				<li class="line">|</li>
				<li>
					<a href="#">登錄</a>
				</li>
				
			</ul>
			
			</div>
		</div>
		<!-- 创建外部头部容器 -->
		<div class="header-warpper">
			<div class="header w">
			<!-- 创建logo -->
			<h1 class="logo" title="小米">
				小米商场
				<a class="home" href="#"></a>
				<a href="#" class="mi"></a>
			</h1>
			<!-- 导航条-->
			<div class="nav-warpper">
		     <ul class="nav clearfix">
				 <li class="all-goods-wrapper"><a class="all-goods" href="#">全部商品分类</a>
				 <!-- 创建左侧导航-->
				 <ul class="left-menu">
					 <li><a href="#">手机 电话卡<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">电视 盒子<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">笔记本 平板<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">家电 插线板<i class="iconfont">&#xe625;</i></a></li>
					  <li><a href="#">出行 穿戴<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">智能 路由器<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">电源 配件<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">健康 儿童<i class="iconfont">&#xe625;</i></a></li>
					 <li><a href="#">耳机 音响<i class="iconfont">&#xe625;</i></a></li>
					  <li><a href="#">生活 箱包<i class="iconfont">&#xe625;</i></a></li>
				 </ul>
				 </li>
				  <li><a href="#1">小米手机</a></li>
				   <li><a href="#1">Reimi 红米</a></li>
				    <li><a href="#1">电视</a></li>
					 <li><a href="#1">笔记本</a></li>
					 <li><a href="#1">家电</a></li>
					 <li><a href="#1">路由器</a></li>
					 <li><a href="#1">智能硬件</a></li>
					 <li><a href="#1">服务</a></li>
					 <li><a href="#1">社区</a></li>
					<div class="goods-infos"></div>
			 </ul>
			 <div class="search-warpper">
				 <form class="search" action="#">
					 <input class="search-inp" type="text">
					 <button class="search-bnt iconfont">&#xe613;</button>
				 </form>
			 </div>
			 </div>
			 
		</div>
		</div>
		<!-- 创建banner的容器 -->
		<div class="banner-wrapper">
			<div class="banner w">
			<ul class="img-list">
				<li><a href="#">
				<img src="./bannner1.png" alt=""></a></li>
			</ul>
			<div class="pointer">
				<a href="#"></a>
				<a href="#"></a>
				<a href="#"></a>
				<a href="#"></a>
				<a href="#"></a>
			</div>
			<div class="prev-next">
				<a  class="prev" href=""></a>
				<a href="#" class="next"></a>
			</div>
	
			</div>
		</div>
	<div class="back-top">
		<ul >
			<li><i class="iconfont">&#xe692;</i>
			<div>手机App</div>
			</li>
			<li><i class="iconfont">&#xe692;</i>
			<div>个人中心</div>
			</li>
			<li><i class="iconfont">&#xec2e;</i>
			<div>人工客服</div>
			</li>
			<li><i class="iconfont">&#xe600;</i>
			<div>购物车</div>
			</li>
		</ul>
	</div>
	<!-- ad -->
	<div class="ad w">
		<ul class="short-cut">
			<li><a href="#"><i class="iconfont">&#xe637;</i>小米秒杀</a></li>
			<li><a href="#"><i class="iconfont">&#xe646;</i>企业团购</a></li>
			<li><a href="#"><i class="iconfont">&#xe647;</i>f卡通道</a></li>
			<li><a href="#"><i class="iconfont">&#xe647;</i>米粉卡</a></li>
			<li><a href="#"><i class="iconfont">&#xe637;</i>以旧换新</a></li>
			<li><a href="#"><i class="iconfont">&#xe638;</i>话费充值</a></li>
		</ul>
		<ul class="ad-img">
			<li><a href="#"><img src="./ad-1.jpg" alt=""></a></li>
			<li><a href="#"><img src="./ad-2.jpg" alt=""></a></li>
			<li><a href="#"><img src="./ad-3.jpg" alt=""></a></li>
		</ul>
	</div>
	<div class="black"></div>
	<div  class="end w">
		<img src="./end.jpg" alt="">
	</div>
	</body>
</html>
.topbar-wrapper{
	width: 100%;
	background-color: #333;
	height: 40px;
	line-height: 40px;
}
/* 左侧导航栏 */
.service{
	float: left;
}
.show-car,.user-info{
	float: right;
}
.service li{
	float: left;
}
.show-car li,.user-info li{
	float: right;
}
.topbar a{
	font-size: 12px;
	color: #b0b0b0;
	display: block;
}
.topbar a:hover{
	color: #fff;
}
.topbar .line{
	color: #424242;
	margin: 0 8px;
}
.show-car a{
	width: 120px;
	background-color: #424242;
	text-align: center;
	height: 40px ;
}
.show-car{
	position: relative;
}
.show-car i{
	margin-right: 2px;
}
.show-car{
	margin-left: 25px;
}
.show-car:hover a{
	background-color: white;
	color: #ff6700;
}
.ts{
	position: absolute;
	padding: 30px;
	top:41px;
	left: -172px;
	width: 232px;
	hight:35px
	background-color: #fff;
	font-size: 10px;
	z-index: 99999;
	text-align: center;
	box-shadow: 0 0 1px 2px rgba(0,0,0,0.2);
	display: none;
}
.show-car:hover .ts,.ts:hover{
	display: inline-block;
}
.app{
	position: relative;
}
.app .qrcode{
	width: 124px;
	height: 0;
	background-color: white;
	line-height: 1px;
	text-align: center;
	box-shadow: 0 0 10px rgb(0,0,0,0.3);
	color: #333;
	position: absolute;
	left: -38px;
	
	transition: all 0.3s;
	overflow: hidden;
}
.app:hover::after,.app:hover .qrcode{
	display: block;
	height: 140px ;
	z-index: 9990;
	float: left;
}
.app:hover::after{
	
	border: 6px solid transparent;
	content: '';
	border-top: none;
	border-bottom-color: white;
	width: 0px;
	height: 0px;
	position: absolute;
	bottom: 0px;
	left: 0;
	right: 0;
	margin: auto;
	/* 设置过渡的样式 */
 
}
.qrcode img{
	width: 90px;
	height: 90px;
	margin: 17px;
	margin-bottom: 15px;
}
/* 设置中间的header */
.header-warpper{
	height: 100px;
	width: 100%;
    position: relative;
}
.header .logo{
	margin-top: 22.5px;
	float: left;
	position: relative;
	width: 55px;
	height: 55px;
	overflow: hidden;
	text-indent: -9999px;
}
.header .logo a{
	
	position: absolute;
	left: 0;
	width: 55px;
	height: 55px;
	background-image: url(logo-mi2.png);
	background-size: 55px 55px;
	background-position: center;
	transition: left 0.3s;
}
.header .logo .home{
	left: -55px;
	background-image: url(./mi.jpg);
	background-size: 55PX 55PX;
} 
.header .logo:hover .mi{
	left: 55px;
}
.header .logo:hover .home{
	left: 0;
}
.header .nav{
	float: left;
	padding-left: 57px;
}
.header .nav-warpper{
	float: left;
	margin-left: 10px;
}
 .nav > li{
	float: left;
}
.all-goods-wrapper{
	position: relative;
}
/* 左侧导航条 */
.left-menu{
	width: 234px;
	height: 436px;
	background-color: rgba(0,0,0,.6);
	position: absolute;
	z-index: 990;
	left: -120px;
	line-height: 1;
	padding-top: 20px;
}
.left-menu a{
	display: block;
	height: 40px;
	line-height:40px;
	color: white;
	font-size: 14px;
	padding: 1px 0;
}
.nav li a:hover{
	color: #ff6700;
}
.left-menu li a:hover{
	background-color: #ff6700;
	color: white;
}
.left-menu li:hover{
	background-color: #ff6700;
	color: white;
}
.left-menu a i{
	float: right;
}
.header .nav{
	z-index: 10000;
	height: 100px;
	line-height: 100px;
	
}
.nav li a{
	display: block;
	
	font-size: 15px;
	margin-right: 20px;
		z-index: 999999;
}
 
.all-goods{
	visibility: hidden;
}
.nav .goods-infos{
	height: 226px;
	
	position: absolute;
	top:100px;
	left: 0;
	height: 0;
	width: 100%;
	transition: height 0.3s;
	background-size: 100% 200px;
    background-image: url(./下滑框.jpg);
	z-index: 99999;
}
 
.nav li:not(:nth-of-type(10),:nth-of-type(1)):hover ~.goods-infos,.goods-infos:hover{
	height: 226px;
	border-top: 1px solid silver;
	box-shadow: 0 5px 3px rgba(0,0,0,0.2);
}
.search-warpper{
	width: 296px;
	height: 51px;
	float: left;
	margin-top: 25px;
	margin-left: 10px;
	border: 1px solid rgb(224,224,224);
}
.search-warpper .search-bnt{
	float: left;
 height: 51px;
 width: 53px;
 border: #b0b0b0;
 
}
.search-warpper .search-inp{
	padding-left: 10px;
	float: left;
	display: block;
	border: none;
	width: 243px;
	height: 50px;
	border-color: #b0b0b0;
	font-size: 15px;
	box-sizing: border-box;
	border: 1px solid rgb(224,224,224);
	border-right: none;
	outline: none;
}
.search-warpper .search-inp:focus{
	outline: 1px solid #ff6700;
}
.search-warpper .search-bnt:hover{
	border-color:silver;
	background-color: #ff6700;
	color: white;
}
 
.banner{
	position: relative;
	height: 537px;
	margin: 0 auto;
	z-index: 1;
}
.banner img{
	width: 100%;
	vertical-align: top;
}
 
.banner .img-list{
	position: absolute;
}
 
.pointer{
	position: absolute;
	bottom: 100px;
	right: 135px;
}
.pointer a{
	float: left;
	margin-left: 6px;
	width: 6px;
	height: 6px;
	background-color: rgba(0,0,0,0.4);
	border: 3px rgba(255,255,255,0.4) solid;
	border-radius: 50%;
}
.pointer a:hover,.pointer a:active{
	border-color: rgba(0,0,0,0.4);
	background-color: rgba(255,255,255,0.4);
}
.prev-next a{
	width: 41px;
	height: 69px;
	background-image: url(箭头图.png);
	background-color: #333;
	position: absolute;
	top: 0;
	bottom: 0;
	margin: auto 0;
}
.prev-next .next{
	left: 257px;
	background-position: -84px 0;
}
.prev-next .prev{
	right: 0;
	
	background-position: -125px 0;
}
.back-top{
	width: 66px;
	height: 232px;
	position: fixed;
	bottom: 60px;
	right: 50px;
}
.back-top li{
	padding-top: 11px;
	border: 1px solid #f5f5f5;
	text-align: center;
}
.ad{
	height: 170px;
	margin-top: 14px;
    position: relative;
}
.ad-img{
	float: left;
}
.ad .ad-img li{
	display: inline-block;
	
}
.ad .short-cut li{
	display: inline-block;
	width: 75px;
	
}
.ad .short-cut li:last-child{
	margin-right: 0;
	
}
.ad .short-cut i{
	display: block;
  font-size: 20px;	
  color: white;
  text-align: center;
}
.ad .short-cut a{
	color: white;
	font-size: 15px;
	display: inline-block;
	height: 80px;
	margin: 0 7px;
	margin-top: 10px;
}
.ad .short-cut{
	width: 234px;
	height: 170px;
	background-color: #5f5750;
	margin-left: 14px;
	position: relative;
	left: -12px;
}
.ad .ad-img li{
	width: 316px;
	margin-left: 10px;
	
}
.ad .ad-img{
	position: absolute;
	left: 235px;
	top:-1px;
}
.ad .ad-img img{
	width: 100%;
	vertical-align: top;
}
.black{
	background-color: #f5f5f5;
	margin-top: 50px;
	width: 100%;
}
.end{
	width: 1226px;
}
*{
	padding: 0;
	margin: 0;
}
li{
	list-style: none;
}
a{
	text-decoration: none;
	color: #000;
}
.clearfix::after,.clearfix::before{
	content: "";
	display: table;
	clear: both;
}
 
body{	
	    font: 14px/1.5 Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif;
	    color: #333;
		min-width: 1226px;
}
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。