abstrait:<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style> *{ margin: 0; padding: 0; } .nav{ height: 40px; bac
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
*{
margin: 0;
padding: 0;
}
.nav{
height: 40px;
background: #ccc;
}
.odiv{
width: 500px;
margin: auto;
}
.odiv li{
list-style: none;
width:100px;
height:40px ;
float:left;
line-height: 40px;
text-align: center;
color: white;
position: relative;
cursor: pointer;
}
.box{
position: absolute;
width: 100px;
height: 120px;
left:0;
display: none;
}
.box li{
width: 100px;
height: 40px;
background: red;
}
.odiv li:hover .box{
display: block;
}
.box li:hover {
color: yellow;
background: #ccc;
}
.first:hover{
background: pink;
}
</style>
</head>
<body>
<div class="nav">
<ul class="odiv">
<li class="first">導(dǎo)航1
<ul class="box">
<li>(1)導(dǎo)航一</li>
<li>(2)導(dǎo)航一</li>
<li>(3)導(dǎo)航一</li>
<li>(4)導(dǎo)航一</li>
</ul>
</li>
<li>導(dǎo)航2</li>
<li>導(dǎo)航3</li>
<li class="first">導(dǎo)航4
<ul cla
ss="box">
<li>(1)導(dǎo)航一</li>
<li>(2)導(dǎo)航一</li>
<li>(3)導(dǎo)航一</li>
<li>(4)導(dǎo)航一</li>
</ul>
</li>
<li>導(dǎo)航5</li>
</ul>
</div>
</body>
</html>
Professeur correcteur:韋小寶Temps de correction:2019-03-11 17:32:19
Résumé du professeur:寫的很不錯(cuò) css來(lái)實(shí)現(xiàn)下拉菜單還是蠻簡(jiǎn)單的 總的來(lái)說(shuō)要比js來(lái)實(shí)現(xiàn)簡(jiǎn)單多了