1. 程式人生 > >開發“小米商城官網首頁”(靜態頁面)

開發“小米商城官網首頁”(靜態頁面)

開發 ul li name containe cursor arch ont select 代碼

一,項目題目:開發”小米商城官網首頁”(靜態頁面)

二,項目需求

1.熟練運用所學知識還原小米商城官網首頁靜態頁面

* 不需要做動態效果,只實現靜態頁面, 後期學完js再回來實現動態效果

  

三,項目布局

技術分享圖片

四,效果對比

  目前的官網圖片和小編做的圖片對比

官網圖片

技術分享圖片

小編做的效果圖

技術分享圖片

五,代碼附上

鏈接:https://pan.baidu.com/s/1EVyF8RIgRXFvEIHQf42Pow

 密碼:zqs4

  

index.html

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>xiaomi</title>
		<link type="text/css" rel="stylesheet" href="css/index.css">
		
		
	
</head>
<body>
	<div class="wrap">
		<!--頂部導航欄-->
		<div class=‘topBar‘>
			<div class = ‘container1‘>
				<!--導航條-->
				<div class="topBar-nav">
					<a href=‘#‘>小米商城</a>
					<span class="sep">|</span>
					<a href=‘#‘>MIUI</a>
					<span class="sep">|</span>
					<a href=‘#‘>loT</a>
					<span class="sep">|</span>
					<a href=‘#‘>雲服務</a>
					<span class="sep">|</span>
					<a href=‘#‘>金融</a>
					<span class="sep">|</span>
					<a href=‘#‘>有品</a>
					<span class="sep">|</span>
					<a href=‘#‘>小愛開放平臺</a>
					<span class="sep">|</span>
					<a href=‘#‘>政企服務</a>
					<span class="sep">|</span>
					<a href=‘#‘>Select Region</a>
				</div>
				
				<!--購物車-->
				<div class=‘topBar-cart‘>
					<a href="#">
						<span class="icon"></span>
						<span class="shop-cart">購物車(0)</span>
					</a>
				</div>
	
				
				<!--用戶信息-->
				<div class=‘topBar-message‘>
					<a href="#">登錄</a>	
					<span class="sep">|</span>
					<a href="#">註冊</a>		
					<span class="sep">|</span>
					<a href="#">消息通知</a>
				</div>
			</div>
		</div>
		
		<div class="header">
			<div class = ‘container2‘>
				<!--小米logo-->
				<div class="header-logo">
					<a href="#">
						<img class=‘logo‘ src=‘img/logo.png‘ alt=‘小米圖標‘>
					</a>
				</div>
				
				<!--第二行 導航欄-->
				<div class="header-nav">
					<ul>
						<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>
						<li><a href = "#">智能硬件</a></li>
						<li><a href = "#">服務</a></li>
						<li><a href = "#">社區</a></li>
					</ul>
				</div>
				
				<!--搜索框-->
				<div class="header-search">
                    <label for="search"></label>
                    <input type="text" name="search" id="search">
                    <span class="hot-words">
                        <a href="#">小米8 </a>
                        <a href="#">小米MIX 2S </a>
                    </span>
                    <input type="submit" value="" id="submit">	               
	            </div>
			</div>
		</div>
		
		<div class=‘content‘>
			<div class = ‘container3‘>
				<!--內容選擇列表 前面部分-->
				<div class=‘con-up‘>
                    <div class="up-1">
                        <ul>
                            <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><span>></span></li>
                            <li><a href="#">耳機 音響</a><span>></span></li>
                            <li><a href="#">生活 箱包</a><span>></span></li>
                        </ul>
                    </div>
					
					<div class=‘up-2‘>
						<a href=‘#‘>
							 <img src="img/xiaomi.jpg" alt="內容圖片" style="width: 1245px;height: 465px">
						</a>
					</div>
				</div>
				
					
				<!--下部分-->
				<div class=‘con-down‘>
					<div class=‘down-1‘>
						<ul>
							<li><div class=‘p-1‘></div><p>選購手機</p></li>
							<li><div class=‘p-2‘></div><p>企業團購</p></li>
							<li><div class=‘p-3‘></div><p>F碼通道</p></li>
							<li><div class=‘p-4‘></div><p>不限量卡</p></li>
							<li><div class=‘p-5‘></div><p>以舊換新</p></li>
							<li><div class=‘p-6‘></div><p>話費充值</p></li>
						</ul>
					</div>
					
					<div class=‘down-2‘>
						<ul>
							<li><a href=‘#‘><img src="img/xiaomiMIX 2S.jpg" alt=‘小米圖片‘</a></li>
							<li><a href=‘#‘><img src="img/hongmi6.jpg" alt=‘紅米圖片‘</a></li>
							<li><a href=‘#‘><img src="img/saodijiqiren.jpg" alt=‘掃地機器人圖片‘</a></li>
						</ul>
					</div>
				</div>
			</div>	
		</div>		
		
		<div class="shop1">
			<div class = ‘container4‘>
				<div class=‘left‘>小米閃購</div>
				<div class=‘right‘>
					<a href = ‘#‘ ><img src=‘img/right.jpg‘ alt=‘左右圖‘></a></div>
			</div>
		</div>
		
		<div class=‘shop2‘>
			<!--選購引導-->	
			<div class = ‘container5‘>
				<div class=‘advertising‘>
					<ul>
						<li><a href = ‘#‘ ><img src=‘img/01.jpg‘ alt=‘閃購圖1‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/02.jpg‘ alt=‘閃購圖2‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/03.jpg‘ alt=‘閃購圖3‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/04.jpg‘ alt=‘閃購圖4‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/05.jpg‘ alt=‘閃購圖5‘></a></li>
					</ul>
				</div>
			</div>
		</div>
		</div>
		
		<!--右側固定導航欄-->
		<div class="back-top">
			<ul id=‘right-ul‘>
				<li><div class=‘fixed-1‘></div><p>個人中心</p></li>
				<li><div class=‘fixed-2‘></div><p>聯系客服</p></li>
				<li><div class=‘fixed-3‘></div><p>購物車</p></li>
				<li><div class=‘fixed-4‘></div><p>返回頂部</p></li>
			</ul>
		</div>
			
		<!--底部內容-->
		<div class=‘footer‘>
			<div class = ‘container6‘>
				<!--小米logo-->
				<div class="footer-logo">
					<a href="#">
						<img class=‘logo‘ src=‘img/logo.png‘ alt=‘小米圖標‘>
					</a>
				</div>
				
				<!--第一行字-->
				<div class="footer-one">
					<a href=‘#‘>小米手機</a>
					<span class="sep">|</span>
					<a href=‘#‘>MIUI</a>
					<span class="sep">|</span>
					<a href=‘#‘>米家</a>
					<span class="sep">|</span>
					<a href=‘#‘>多看</a>
					<span class="sep">|</span>
					<a href=‘#‘>遊戲</a>
					<span class="sep">|</span>
					<a href=‘#‘>路由器</a>
					<span class="sep">|</span>
					<a href=‘#‘>米粉卡</a>
					<span class="sep">|</span>
					<a href=‘#‘>政企服務</a>
					<span class="sep">|</span>
					<a href=‘#‘>小米天貓店</a>
					<span class="sep">|</span>
					<a href=‘#‘>隱私政策</a>
					<span class="sep">|</span>
					<a href=‘#‘>問題反饋</a>
					<span class="sep">|</span>
					<a href=‘#‘>廉政舉報</a>
					<span class="sep">|</span>
					<a href=‘#‘>Select Region</a>
				</div>
				
				<!--第二行字-->
				<div class="footer-two">
					<a href=‘#‘>@mi.com</a>
					<a href=‘#‘>京ICP證110507號 京ICP證110507號 京ICP證110507號 京ICP證110507號</a>
				</div>
				
				<!--第三行字-->
				<div class="footer-three">
					<a href=‘#‘>違法和不良信息舉報電話: </a>
					<a href=‘#‘>185-0130-1238, </a>
					<a href=‘#‘>本網站所列數據,除特殊說明,所有數據均出自我司實驗室測試</a>
				</div>
				
				<!--第4行圖-->
				<div class="footer-photo">		
					<ul>
						<li><a href = ‘#‘ ><img src=‘img/footer1.png‘ alt=‘廣告1‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/footer2.png‘ alt=‘廣告2‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/footer3.png‘ alt=‘廣告3‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/footer4.png‘ alt=‘廣告4‘></a></li>
						<li><a href = ‘#‘ ><img src=‘img/footer5.png‘ alt=‘廣告5‘></a></li>
					</ul>
				</div>
				
				
		</div>
			<p>探索黑科技,小米為發燒而生!</p>
		</div>

</body>
</html>

  

indesx.css

*{
	padding: 0;
	margin: 0;
}

.wrap{
	width: 100%;
	/*有父子關系的margin 防止外邊距合並*/
	overflow: hidden;
	/*設置透明度*/
	/*background-color: rgba(245,245,245,0.98);*/
}

ul>li{
	list-style: none;
}

a{
	text-decoration: none;
}

.topBar{
	height: 40px;
	line-height: 40px;
	font-size: 12px;
	background-color: black;
}

.topBar a{
    color:#b0b0b0; /*字體顏色*/
}

.topBar a:hover{    
	/* 偽類選擇器 hover鼠標懸停時超鏈接狀態*/
    color: white;
}

.topBar .sep{
    color: #424242;
    margin: 0 2px;  /*外邊距*/
}

.container1{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}

.topBar-nav{
	float: left;
}

.topBar-cart,.topBar-message{
	float: right;
}

.topBar-cart .icon{     
	/*給購物車添加背景圖片*/
    background: url("../img/shop1.png") 3px 24px;
    width: 35px;
    height: 22px;
    display: inline-block;
    /*行內塊元素 同時具有行內和和塊級元素,和其他元素在一行,距離都可以設置*/
    position: relative;
    top:6px;
}

.topBar-cart a{
    /*display: block; !*塊級元素,每個塊級元素都從新的一行開始,距離都可設置*!*/
    margin-left: 15px;
    padding: 0 15px;
}

.topBar-cart a:hover{
    background-color: white;
    color: rgba(255,103,0,0.98);
}

.header{
	height: 100px;
	line-height: 100px;
	overflow: hidden;
}

.container2{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}

.header-logo,.header-nav{
	float: left;
	height: 100px;
}

.header-logo .logo{
	margin-right: 10px;
	margin-top: 20px;
}

.header-search{
	float: right;
	position: relative;
}
.header-nav ul li{
	float: left;
	margin: 0 auto;
	padding: 0 10px;
	color: #000000;
}

.header-nav ul li a{
	color: #333;
	font-size: 16px;
}

.header-nav ul li a:hover{
	color: rgba(255,103,0,0.98);
}

.header-search input[type="text"]{
    height: 44px;
    width: 243px;
    border: 1px solid #e0e0e0;
    margin-right: -1px;
}

.header-search input[type="text"]:hover{
    border: 1px solid #b0b0b0;
}

.header-search input[type="text"]:focus{    
	/*獲取焦點時的樣式*/
    outline:none;  /*輪廓是繪制於元素周圍的一條線,位於邊框邊緣的外圍,可起到突出元素的作用*/
}

.hot-words{
	font-size: 12px;
	position: absolute;
	right: 40px;
}

.hot-words a{
	background-color: #eee;
	color: #757575;
	padding: 3px 6px;
	position: relative;
	top: 2px;
	right: 16px;
}

.hot-words a:hover{
    background-color: rgba(255,103,0,0.98);
    color: white;
}

.header-search input[type=‘submit‘]{
	height: 45px;
	width: 45px;
	background: url("../img/search1.png") no-repeat 3px 6px; 
	border: 1px solid #E0E0E0;
	position: relative;
	top: 17px;
	cursor: pointer;
	left: -5px;
}

.header-search input[type="submit"]:hover{
    background: url("../img/search2.png") no-repeat 8px 8px;
    background-color: rgba(255,107,0,0.98);
}

.content .con-up .up-1{
	background-color: rgba(0,0,0,0.6);
	width: 240px;
	position: absolute;
}

.container3{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}

.con-up ul:before,.con-up:after{
	/*用子盒子來填充父盒子 解決浮動產生的問題*/
	content: "";
	height: 26px;
	display: block;
}

.con-up ul li{
	padding: 10px 25px;
}

.con-up ul li:hover{
	background-color: #ff6700;
}

.con-up ul li a{
	color: white;
}

.con-up ul li span{
	float: right;
	color: white;
}

.con-down{
	overflow: hidden;
	padding-top:10px ;
}
.con-down .down-1{
	width: 240px;
	overflow: hidden;
	background-color: #665e57;
	float: left;
}

.con-down ul{
	overflow: hidden;
}

.con-down .down-1 ul li{
	float: left;
	width: 78px;
	height: 83px;
	border: 1px solid #665e57;
	text-align: center;
}

.down-1 ul li p{
    color: #b0b0b0;
    position: relative;
    font-size: 15px;
}

.down-1 ul li p:hover{
    color: white;
}

.down-1 .p-1{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.down-1 .p-2{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.down-1 .p-3{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.down-1 .p-4{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.down-1 .p-5{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.down-1 .p-6{
    background: url("../img/tubiao.png") no-repeat center;
    background-size: 50px; height: 60px;}
    
.con-down .down-2{
	float: left;
}

.con-down .down-2 ul li{
	float: left;
}

.down-2 img{
    width: 315px;
    height: 170px;
    margin-left: 13px;
}

.down-2 img:hover{
    box-shadow: 0 5px 1px #b0b0b0; /*box-shadow 向框添加一個或多個陰影*/
}

.shop1{
	height: 58px;
	line-height: 58px;
	font-size: 22px;
	color: #333333;
}

.shop1 .left .right:hover{
	color: white;
}

.container4{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}

.shop1 .left{
	float: left;
	margin-top: 15px;
	font-size: 22px;
	font-weight: 200;
	line-height: 58px;
	color: #000000;
}
.shop1 .right{
	float: right;
	margin-top: 15px;
}
.shop2{
	margin: 0 auto;
	width: 1240px;
	height: 339px;
	padding-top: 39px;
	border-top-width: 1px;
	color: #e53935;
}

.container5{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}
.shop2 ul li{
	float: left;
	width: 234px;
	margin-right: 11px;
	/*padding-right: 1px;*/
	color: #333;
}
.shop2 ul li a{
	color: #000000;
	font-size: 100%;
	
}

.shop2 ul li a:hover{ 
	color: orange;
}
    
.back-top{
	position: fixed;
	right: 0;
	top: 400px;
	background-color: white;
}

.back-top ul li{
	font-size: 14px;
	padding: 10px;
	border: 1px solid #E0E0E0;
}

.back-top ul li:hover{
	color: #757575;
	cursor: pointer;
}

.back-top ul li p{
	text-align: center;
	padding-top: 5px;
}

.back-top .fixed-1{
    background: url("../img/fixed.png") no-repeat center;
    background-size: 30px; 
    height: 30px;
}

.back-top .fixed-2{
    background: url("../img/erji.png") no-repeat center;
    background-size: 30px;
    height: 30px;
}
    
.back-top .fixed-3{
	background: url("../img/shopping_cart.png") no-repeat center;
    background-size: 30px;
    height:30px ;
}

.back-top .fixed-4{
	background: url("../img/back_top.png") no-repeat center;
    background-size: 30px;
    height:30px ;
}


.footer{
	padding: 30px 0;
	font-size: 12px;
	background-color: #fafafa;
}

.container6{
	width: 1225px;
	overflow: hidden;
	margin: 0 auto;
}

.footer-logo a{
	margin-right: 10px;
	float: left;
	width: 57px;
	height: 57px;
}
.footer-one .footer-two .footer-two{
	float: left;
}

.footer-photo{
	float: right;
}

.footer-photo ul li{
	float: right;
	width: 83;
	height: 28px;
	margin-left: 0px;
	/*padding-right: 1px;*/
	color: #333;
}
.footer-photo ul li a{
	color: #000000;
	font-size: 100%;
	
}

.footer-photo ul li a:hover{ 
	color: orange;
}

.footer p{
	padding: 30px 0;
	text-align: center;
	color: #333;
	font-size: 14px;
	background: #fff;
	font-family: "楷體";
	min-width: 1226px;
}

  

開發“小米商城官網首頁”(靜態頁面)