abstract:<!DOCTYPE html><html lang="zh_cn"><head> <meta charset="UTF-8"><!-- <link rel="stylesheet" href="static/css/s
<!DOCTYPE html>
<html lang="zh_cn">
<head>
<meta charset="UTF-8">
<!-- <link rel="stylesheet" href="static/css/style1.css">-->
<link rel="stylesheet" href="static/css/font-awesome-4.7.0/css/font-awesome.css">
<title>Title</title>
<style>
/*給所有標簽定義*/
* {
margin: 0;
padding: 0;
}
/*給a標簽定義一個固定樣式*/
a {
text-decoration-line: none;
color: #C3C3C3;
font-size: 13px;
}
.clear {
clear: both;
}
/*導航欄設置背景顏色和高度*/
.header {
background-color: #F5F5F5;
height: 40px;
width: 100%;
}
/*導航欄內容框的寬高設置*/
.header_content {
width: 1200px;
line-height: 40px;
margin: 0 auto;
background-color: #F5F5F5;
}
/*設置左邊導航欄的高度,并進行向左浮動*/
.header_left {
height: 40px;
float: left;
}
/*設置左邊導航欄按鈕間的間距*/
.header_left a {
margin-right: 3px;
}
/*設置右邊導航欄的高度,并進行向右浮動*/
.header_right {
height: 40px;
float: right;
}
/*設置右邊導航欄按鈕間的間距*/
.header_right a {
margin-left: 3px;
}
/*將.header_a類選擇器中元素該為行內塊元素,并設置文本居中顯示*/
.header_a{
display: inline-block;
height: 40px;
width: 80px;
text-align: center;
position: relative;
}
/*添加光標停留時.header_a類標簽的顯示效果*/
.header_a:hover {
/*line-height: 40px;*/
background-color: white;
}
/*添加光標停留時<a>的顯示效果*/
a:hover {
color: #FF5000;
}
/*設置無序列表的隱藏和border*/
.header_right_a {
border:1px solid #F5F5F5;
border-top: none;
display: none;
}
/*取消無序列表的小點,設置列表內容的高度和文字向左對齊*/
li {
list-style: none;
color: #6c6c6c;
height: 30px;
line-height: 30px;
text-align: left;
background-color: #F5F5F5;
}
/*當光標移動到<a>范圍時的顯示效果,用絕對定位來顯示隱藏的導航按鈕*/
.header_right a:hover ul {
display: block;
position: absolute;
}
/*選擇到隱藏的導航按鈕時的顯示效果*/
ul li:hover{
background-color: #C3C3C3;
color: #FF5000;
}
</style>
</head>
<body>
<div class="header">
<div class="header_content">
<div class="header_left">
<a href="" class="header_a">中國大陸   <i class="fa fa-angle-down"></i></a>
<a href="" style="color: #FF5000">親,請登錄</a>
<a href="">免費注冊</a>
<a href="">手機逛淘寶</a>
</div>
<div class="header_right">
<a href="" class="header_a">我的淘寶<i class="fa fa-angle-down"></i>
<ul class="header_right_a">
<li>已買到的寶貝</li>
<li>我的足跡</li>
</ul>
</a>
<a href="" ><i class="fa fa-shopping-cart" style="color: #FF5000"></i>   購物車</a>
<a href="" class="header_a"><span class="fa fa-star"></span>   收藏夾<i class="fa fa-angle-down"></i></a>
<a href="" class="header_a">商品分類</a>
<a href="" class="header_a">賣家中心   <i class="fa fa-angle-down"></i></a>
<a href="" class="header_a">聯(lián)系客服</a>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
這個頁面有曾經學習過的position絕對定位,有無序列表的使用,有盒子模型的應用,雖然只有一個導航欄,卻用到很多知識點才能完成,過程中要不斷調試css樣式才能實現(xiàn)最終效果,有時候忘記了屬性還要去w3c查,感覺練習量不夠,常用的屬性可以直接敲出,但是少用的還是要查,現(xiàn)在學到的才是靜態(tài)頁面,一定要多花時間練習,多做。
Correcting teacher:查無此人Correction time:2019-05-05 09:36:52
Teacher's summary:完成的不錯。常用的css樣式,可以寫到一個公用文件里,隨時可以使用。繼續(xù)加油。