abstrakt:繼續(xù)根據(jù)17173網(wǎng)站導航條的的下拉菜單進行模仿下拉菜單案例!結(jié)合兩次作業(yè),個人理解制作導航一定要提前有多規(guī)劃,不光要規(guī)劃好各盒子的寬度高度,更要對盒子的層級有清晰的定位!只有提前定位好層級,才能更好的結(jié)合實際情況,做出好的導航條!還是要多多練習~練習的多才能做出更符合用戶審美的布局!本機上是HTML跟CSS文件分開制作的~因為要上傳作業(yè)~所以把CSS文件里的復制到HTML文件里方便上傳!<
繼續(xù)根據(jù)17173網(wǎng)站導航條的的下拉菜單進行模仿下拉菜單案例!
結(jié)合兩次作業(yè),個人理解制作導航一定要提前有多規(guī)劃,
不光要規(guī)劃好各盒子的寬度高度,
更要對盒子的層級有清晰的定位!
只有提前定位好層級,才能更好的結(jié)合實際情況,做出好的導航條!
還是要多多練習~練習的多才能做出更符合用戶審美的布局!
本機上是HTML跟CSS文件分開制作的~因為要上傳作業(yè)~所以把CSS文件里的復制到HTML文件里方便上傳!
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>17173導航條</title>
<link rel="stylesheet" type="text/css" href="font-awesome-4.7.0/css/font-awesome.min.css">
<style type="text/css">
*{
margin: 0px;
padding: 0px;
/*清楚瀏覽器的默認邊距樣式*/
}
li{list-style: none}
a{
text-decoration: none;
color: black;
font-size: 15px;
}
/*清除默認鏈接下劃線,設(shè)置顏色跟字體大小*/
a:hover{
color: #ee7800;
}
.tapnav{
width: 100%;
height: 45px;
background-color: #38b48b;
}
/*1.首先設(shè)置頂部導航條的寬高背景顏色*/
.tapnav_con{
width: 1280px;
height: 45px;
margin:0px auto;
line-height: 45px;
}
/*2.設(shè)置中間導航條的寬高,line-height: 設(shè)置行高(一般同導航條寬度)
margin:0px auto;設(shè)置對象上下間隔為0px,左右間隔根據(jù)對象寬度自適應(yīng)。*/
.tapnav_c1{
width: 250px;
height: 45px;
float:left;
}
/*3.分析各個盒子的寬度跟浮動效果,設(shè)置c1 c2 c3 user寬高跟排序*/
.tapnav_d1{
padding-right: 20px;
}
/*4.設(shè)置左側(cè)盒子標簽1的格式*/
.tapnav_d2{
width: 108px;
height: 45px;
display: inline-block;
position: relative;
text-align: center;
/*8.設(shè)置導航欄相對定位,同時設(shè)置下拉菜單絕對定會,就可以解決移動顯示下拉菜單時其他標簽跟隨移動的問題*/
}
/*5.設(shè)置左側(cè)盒子標簽2的格式*/
.tapnav_d2:hover{
background-color: white;
}
.tapnav_e1{
width: 106px;
border-left: #cccccc 1px solid;
border-right: #cccccc 1px solid;
border-bottom: #cccccc 1px solid;
display: none;
}
/*6.設(shè)置導航下拉菜單邊框的屬性,并設(shè)置隱藏不顯示*/
.tapnav_d2:hover .tapnav_e1{
display: block;
position: absolute;
}
/*7.設(shè)置鼠標放置到導航菜單的位置,顯示下拉菜單*/
.tapnav_f1{
height: 120px;
text-align:left;
padding-left: 10px;
}
/*9.分析下拉菜單的寬高邊距來進行設(shè)置*/
.tapnav_f2{
height: 30px;
line-height: 30px;
font-weight: bold;
color: #ee7800;
text-align:left;
padding-left: 10px;
}
.tapnav_f3{
height: 60px;
text-align:left;
padding-left: 10px;
}
.tapnav_g1{
height: 30px;
line-height: 30px;
font-weight: bold;
color: #ee7800;
}
.tapnav_g2{
height: 30px;
line-height: 30px;
text-indent: 15px;
}
.tapnav_c2{
width: 400px;
height: 45px;
float:left;
}
.tapnav_c3{
width: 100px;
height: 45px;
float:right;
}
.tapnav_user{
width: 120px;
height: 45px;
float:right;
}
</style>
</head>
<body>
<div class="tapnav"><!--整體導航條盒子-->
<div class="tapnav_con"><!-- 中心控制條盒子-->
<div class="tapnav_c1"><!--左側(cè)控制條盒子-->
<span class="tapnav_d1"><a href="">17173首頁</a></span><!--首頁盒子-->
<div class="tapnav_d2"><!--網(wǎng)站導航-->
<a href=""><span class="fa fa-navicon (alias)" style="color: #ee7800"></span>網(wǎng)站導航</a><!--網(wǎng)站導航-->
<div class="tapnav_e1"><!--網(wǎng)站導航下拉菜單-->
<div class="tapnav_f1">
<div class="tapnav_g1"><a href="">找游戲</a> </div>
<div class="tapnav_g2">
<ul>
<li><a href="">近期熱門</a></li>
<li><a href="">最新入庫</a> </li>
<li><a href="">最新測試</a> </li>
</ul>
</div>
</div>
<div class="tapnav_f2"><a href="">看新聞</a> </div>
<div class="tapnav_f3">
<div class="tapnav_g1"><a href="">看視頻</a></div>
<div class="tapnav_g2"><a href="">游戲直播</a> </div>
</div>
<div class="tapnav_f2"><a href="">搶號</a></div>
<div class="tapnav_f2"><a href="">領(lǐng)福利</a> </div>
<div class="tapnav_f2"><a href="">逛論壇</a> </div>
</div>
</div>
</div>
<div class="tapnav_c2"></div><!--中間控制條盒子-->
<div class="tapnav_c3"></div><!--熱門游戲控制盒子-->
<div class="tapnav_user"></div><!--右側(cè)控制條盒子-->
</div>
</div>
</body>
</html>
Korrigierender Lehrer:查無此人Korrekturzeit:2019-04-27 17:33:13
Zusammenfassung des Lehrers:完成的不錯,可以把常用的css樣式寫到一個文件,下次直接可以使用。繼續(xù)加油