H5培訓(xùn)_H5導(dǎo)航制作
發(fā)布時(shí)間:
2019-08-18 17:32:56
1.導(dǎo)航欄(nav)實(shí)現(xiàn)效果
導(dǎo)航欄主要分為兩種:水平導(dǎo)航欄和垂直導(dǎo)航欄,其中水平導(dǎo)航欄又有普通導(dǎo)航欄與簡約導(dǎo)航欄等樣式設(shè)置。
2.實(shí)現(xiàn)思路:
導(dǎo)航欄的實(shí)現(xiàn)主要使用ul標(biāo)簽或ol結(jié)合li列表,a標(biāo)簽,設(shè)置a標(biāo)簽為塊元素,可為其設(shè)置寬高,將其向左浮動(dòng)就可形成水平導(dǎo)航欄,取消其默認(rèn)的原點(diǎn)與下劃線樣式,并為鼠標(biāo)移入時(shí)增加樣式,顏色較深的背景色的導(dǎo)航欄,鼠標(biāo)移入時(shí),多會(huì)修改移入部分背景色,背景為白色的導(dǎo)航欄在鼠標(biāo)移入時(shí),可為其添加下滑線等樣式,以追求其美觀性。
例子:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>導(dǎo)航條</title>
<style>
.nav li{
/*border: black solid 1px;*/
background-color: black;
float: left;
/*列表的點(diǎn)去掉*/
list-style: none;
width: 100px;
height: 30px;
text-align: center;
/*當(dāng)行高等于父容器高度的時(shí)候,文字垂直方向居中*/
line-height: 30px;
color: white;
}
/*當(dāng)鼠標(biāo)放上去,改變btn的顏色*/
.nav li:hover{
color: white;
font-weight: bold;
background: deeppink
}
</style>
</head>
<body>
<ul class=’nav’>
<li>首頁</li>
<li>公司簡歷</li>
<li>產(chǎn)品中心</li>
<li>聯(lián)系方式</li>
</ul>
</body>
</html>
總結(jié)
采用無序列表UI制作導(dǎo)航欄效果,結(jié)合li與a標(biāo)簽使用。
上一篇:
人工智能AI培訓(xùn)_圖像數(shù)據(jù)預(yù)處理實(shí)驗(yàn)
下一篇:
Python培訓(xùn)_Python自動(dòng)化運(yùn)維之Saltstack安裝